try fix top margin issue

This commit is contained in:
ylzheng
2015-11-02 21:51:48 +08:00
parent 24ffee3ae5
commit a1475356a4
5 changed files with 24 additions and 46 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9052" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Q9y-iX-B8K">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9052" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="AhI-Wn-KM8">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9040"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
@@ -143,7 +143,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Dln-HB-Sxz" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-5698" y="1418"/>
<point key="canvasLocation" x="-4210" y="1674"/>
</scene>
<!--个人中心-->
<scene sceneID="A4Z-AK-Yy0">
@@ -660,7 +660,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Nbs-Ez-3W6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-6395" y="5051"/>
<point key="canvasLocation" x="-7051" y="5579"/>
</scene>
<!--首页-->
<scene sceneID="5S6-yX-Ikb">
@@ -890,7 +890,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="wQd-t8-Eyc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-5542" y="5626"/>
<point key="canvasLocation" x="-8029" y="5097"/>
</scene>
<!--探索发现-->
<scene sceneID="Krh-MH-97G">
@@ -1612,7 +1612,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="gWH-Uq-2dG" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-4842" y="1427"/>
<point key="canvasLocation" x="-5074" y="1647"/>
</scene>
<!--标签页-->
<scene sceneID="Lgs-sK-2PE">
-4
View File
@@ -21,10 +21,6 @@ class ContainerViewController: UIPageViewController {
let staticProfileTableViewController = self.storyboard?.instantiateViewControllerWithIdentifier("GraphsUIViewController") as! GraphsUIViewController
myPostStoriesTableViewController.isInlineOfContainer = true
likeProfileTableViewController.isInlineOfContainer = true
faviroteProfileTableViewController.isInlineOfContainer = true
if self.isMe {
likeProfileTableViewController.postSection = .Liked
myPostStoriesTableViewController.postSection = .MyPostTimeLine
+6 -9
View File
@@ -14,7 +14,7 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
@IBOutlet weak var shareButton: UIBarButtonItem!
private var loginStateChange: LoginStateHandler?
var menu: NSArray = ["信息流", "最新", "热门"]
var storysViewController1: StorysTableViewController!
var storysViewController2: StorysTableViewController!
@@ -26,6 +26,10 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController?.navigationBarHidden = false
self.pager.view.bounds = CGRectInset((parentViewController?.view.frame)!, 0, 52.0)
self.datasource = self
self.delegate = self
@@ -43,22 +47,15 @@ class DashViewController: RGPageViewController, RGPageViewControllerDataSource,
self.storysViewController1 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
self.storysViewController1.postSection = .HotTimeLine
self.storysViewController1.isInlineOfContainer = false
self.storysViewController2 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
self.storysViewController2.postSection = .RecentTimeLine
self.storysViewController2.isInlineOfContainer = false
self.storysViewController3 = storyboard.instantiateViewControllerWithIdentifier("StoriesTableViewController") as! StorysTableViewController
self.storysViewController3.postSection = .Default
self.storysViewController3.isInlineOfContainer = false
}
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
}
func numberOfPagesForViewController(pageViewController: RGPageViewController) -> Int {
return menu.count
}
+12 -15
View File
@@ -60,7 +60,7 @@ class RGPageViewController: UIViewController, UIPageViewControllerDataSource, UI
}
var tabIndicatorWidthOrHeight: CGFloat {
get {
return 1.0
return 2.0
}
}
var tabIndicatorColor: UIColor {
@@ -75,7 +75,7 @@ class RGPageViewController: UIViewController, UIPageViewControllerDataSource, UI
}
var tabStyle: RGTabStyle {
get {
return .None
return .InactiveFaded
}
}
// MARK: - Tabbar
@@ -433,7 +433,7 @@ class RGPageViewController: UIViewController, UIPageViewControllerDataSource, UI
switch tabbarPosition {
case .Top, .Bottom:
newTabRect.origin.x -= tabMargin / 2.0
newTabRect.origin.x -= (index == 0 ? tabMargin : tabMargin / 2.0)
newTabRect.size.width += tabMargin
case .Left, .Right:
newTabRect.origin.y -= tabMargin / 2.0
@@ -473,7 +473,7 @@ class RGPageViewController: UIViewController, UIPageViewControllerDataSource, UI
switch tabbarPosition {
case .Top, .Bottom:
newTabRect.origin.x -= tabMargin / 2.0
newTabRect.origin.x -= (index == 0 ? tabMargin : tabMargin / 2.0)
newTabRect.size.width += tabMargin
case .Left, .Right:
newTabRect.origin.y -= tabMargin / 2.0
@@ -514,24 +514,21 @@ class RGPageViewController: UIViewController, UIPageViewControllerDataSource, UI
private func updatePager(index: Int) {
if let vc: UIViewController = viewControllerAtIndex(index) {
weak var weakSelf: RGPageViewController? = self
weak var weakPager: UIPageViewController? = pager
if index == currentPageIndex {
pager.setViewControllers([vc], direction: .Forward, animated: false, completion: { (Bool) -> Void in
weakSelf!.animatingToTab = false
pager.setViewControllers([vc], direction: .Forward, animated: false, completion: { [weak self] (Bool) -> Void in
self?.animatingToTab = false
})
} else if !(index + 1 == currentPageIndex || index - 1 == currentPageIndex) {
pager.setViewControllers([vc], direction: index < currentPageIndex ? .Reverse : .Forward, animated: true, completion: { (Bool) -> Void in
weakSelf!.animatingToTab = false
pager.setViewControllers([vc], direction: index < currentPageIndex ? .Reverse : .Forward, animated: true, completion: { [unowned self] (Bool) -> Void in
self.animatingToTab = false
dispatch_async(dispatch_get_main_queue(), {
weakPager!.setViewControllers([vc], direction: index < weakSelf!.currentPageIndex ? .Reverse : .Forward, animated: false, completion: nil)
dispatch_async(dispatch_get_main_queue(), { [unowned self] in
self.pager.setViewControllers([vc], direction: index < self.currentPageIndex ? .Reverse : .Forward, animated: false, completion: nil)
})
})
} else {
pager.setViewControllers([vc], direction: index < currentPageIndex ? .Reverse : .Forward, animated: true, completion: { (Bool) -> Void in
weakSelf!.animatingToTab = false
pager.setViewControllers([vc], direction: index < currentPageIndex ? .Reverse : .Forward, animated: true, completion: { [weak self] (Bool) -> Void in
self?.animatingToTab = false
})
}
+1 -13
View File
@@ -22,8 +22,7 @@ class StorysTableViewController: UITableViewController {
// mark : data
private var posts:[Post] = []
var isInlineOfContainer = false
var postSection : PostsLoader.PostSection = .Default {
didSet {
postsLoader = PostsLoader(postSection)
@@ -40,7 +39,6 @@ class StorysTableViewController: UITableViewController {
self.refreshControl?.tintColor = UIColor(red: 46/255.0, green: 204/255.0, blue: 113/255.0, alpha: 1.0)
self.refreshControl?.addTarget(self, action: "refresh", forControlEvents: .ValueChanged)
self.refreshControl?.backgroundColor = UIColor(white: 0.97, alpha: 1)
self.tableView.addSubview(refreshControl!)
self.tableView.separatorColor = UIColor(red:240.0/255.0,
@@ -50,12 +48,6 @@ class StorysTableViewController: UITableViewController {
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.backgroundColor = UIColor(white: 0.97, alpha: 1)
// Table View
let tableFooterView:UIView = UIView()
tableFooterView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 44)
tableFooterView.backgroundColor = UIColor.whiteColor()
self.tableView.tableFooterView = tableFooterView
// mark start refreshing
self.refreshControl?.beginRefreshing()
@@ -70,10 +62,6 @@ class StorysTableViewController: UITableViewController {
// reload data when view did appear
self.tableView.reloadData()
if !isInlineOfContainer {
self.tableView.contentInset.top = 160
}
// load data at first time
if firstTime {
refresh()