UIPageViewController showing part of next childViewController - ios

I have a UIPageViewController that shows 3 child view controllers. The controller is working fine, but on the first page he shows a few vertical columns of pixels from the second page (you can see the grey of the search bar and a selected cell). This behavior is not occurring between the 2nd and 3rd child VC.
First VC (see the overlap on the right side)
Second VC (no overlap on the left or right from the 1st or 3rd)
Third VC:
The code relevant to this issue is here: http://pastebin.com/Dn7nkKHj
Could this be an auto-layout issue? Or an issue with the UIPageViewController. And how can I avoid/correct it?

I don't think that this is an auto layout issue because if there is some issue due to auto layout it will create same effect with second and third view controllers also. Can you please share our storyboard so that I can look check whether there is some auto layout issue.

This is a bug, filed in bug reporter as bug n° 22947439
There is a workaround however:
In the above screenshot, I have circled with a red dashed line the setting you need to un-check. After this, you need to make sure the “constant” value is not -20, but 0. Repeat this for all the leading and trailing constraints of your table views.

Related

UIScrollView gets created at wrong position for first time

I'm trying to create a scroll view which goes behind of navigation controlled but when the view controller is viewed at the first time scrollview gets created below UINavigation Bar if you scroll it gives a leg and gets adjusted and works fine. I check everything but I didn't found the problem I think it's a Bug
It's Little bit difficult to notice in GIF. I Have Attached a project creating that problem just have a look at it. It's attached below
LINK TO PROJECT
The problem can be solved unchecking Adjust Scroll View Insets as shown below. This stops your scroll view from ignoring you auto layout constraints and stops it from adjusting its bounds from your navigation bar.

Overlapping section names in UITableView in Swift

I have a container in my UIControlView.
This is the relevant part of Storyboard. The starting view is a TabBarController, that has a TableView (named _Constructed_) in its second tab. The Table is embedded in NavigationController. When user taps at a cell in this Table, he's taken (with a Show segue) to a GameDetailViewController, that has two containers - the upper one is PageView and the bottom one is TableView.
The issue appears in this TableView. Even though I have constraints set up (width is the same superview's, height is from bottom tabBar to the upper Container, which has fixed height and width), both upper and bottom sides are kinda pushed in a way.
I managed to fix this issue by merely restarting XCode and reopening the project a few times. Maybe it's some kind of a bug, I haven't changed my code in any way and it just started working.
I suggest you need to pay attention to the Size Classes you used. When you reopen your Xcode, it directs you back AnyW, AnyH. It might change the fixed size under some scenario. Also, make sure that you are testing using the same simulator.
I had the same problem.
Im not sure, but you can replace the header from the tableView and it would work right.
tableView.tableHeaderView = myPageView
If it's not the case you should manage the contentInset and contentOffset by yourself for your header and for the list.

UITableView leaving gap below transparent UINavigationBar (within single UIView on UIViewController)

I am working on a Swift iOS8/9 project and using Xcode 7, with storyboard / autolayout, etc. (For completeness: I started at the beginning on the year on older versions of Xcode, etc.)
I have a a UINavigationController hierarchy and some View Controllers contain a single UIView which contain a single child, a UITableView. (I am choosing not to use UITableViewController, so suffice to say ... it is not an option.)
The problem: The tableview starts 64 pixels (status plus nav height) too low:
Now: I've had things working for some of my UIViewControllers containing a UICollectionView within a UIView but I achieved it (after lots of poking / prodding, and a while back) by a top alignment constraint from the top of the UICollectionView to the top of the Top Layout Guide. (Looking through my storyboard I some alignments and some vertical distances, but all to top of Top Layout Guide.)
I am looking for help understanding if I can do what I want, if the approach of constraining the top of the tableview to the top of the layout guide is correct, or if there is a better way.
Unfortunately, I cannot seem to repeat this (perhaps 'cos I've forgotten some key press combination jujitsu, or new Xcode, or collection != table, or something in my view hierarchy. (I've checked all segues are adaptive push, I've even deleted/re-built this VC since I had one model segue, just in case it was confused that this VC isn't in a navigation view controller hierarchy.)
If I control/drag to connect or select the two to align:
this is what I am offered - note no "align to top":
Note: Here are the table settings that (to my understanding) should be adjusting edge inset and scroll offsets correctly, and do appear to ('cos it is the only child of the top view, per documentation.)
Here are the frames after view did layout subviews:
The approach that I ended up using came to me when I spoke to #ProgrammingBonn and mentioned the frames. I saw that the primary UIView was position as I wanted, and so it (finally) dawned on me to align the top of UITableView to the top of the UIView.
(I suspect that much as I was building my own ViewController and not relying upon UITableViewController I had an over inflated view of this particular view within the hierarchy. It was a subview not a primary view, despite occupying all the screen real-estate.)
So, to be clear:
I selected the UITableView, then command/selected the UIView (the main one, and it's parent) and then used the "align" tool to top align those two.
Try unchecking the "Adjust Scroll View Insets" option.
I am not sure whether this will fix your problem but have you tried playing around with viewController.edgesForExtendedLayout?
See more info here:
Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7

ViewController gets misplaced, when a view size is adjusted

I'm quite new to the Xcode programming. I've added some view controller, labels, buttons and image view to my program, but, when I try to adjust, for example, the size of a label, the view controller that that label is in, gets displaced. I mean, when I try to drag the side of the label to change its size, the view controller moves down, making my label get displaced in the view controller. It is a very weird situation, here you have the screenshot of my project, the view controller misplaced is the one that says "Perfil" on the navigation bar. Every time I try to change one of those light blue views size, the entire view controller changes place. The more I try to change the side the more it will go down.
Sorry for my English, not my native language.
I think the bigger issue is that you are using Table View Cells that are not part of a table view.
Table ViewCells are supposed to be a part of a UITableView and not just stuck in a view.
Using UITableViewCells in this way is what is causing the strange behavior.
If you are trying to make a table, put a UITableView in your view, and then you can customize the table view cells in there.
It you aren't trying to make a table, just use UIView's instead of those UITableViewCells.
I have two ideas that may fix the problem:
First, if you're trying to drag and drop the label but the view controller moves instead, then you might just be grabbing the view controller's background by mistake. When this happened to me, it was because the order of my components in the xib file was wrong. Things are ordered from back to front, and when you click and drag something, you'll just be clicking and dragging whatever's on top. You can try and get past this by clicking the UI element on the left to be sure you select it, then dragging the handles.
It looks like you have things in a reasonable order, so that may not be the culprit at all.
Second, if that doesn't work, select the element you want to edit on the left, then open up the utilities pane on the right. Click the Attributes icon (should be fourth from the left) and look towards the bottom. You should see something like this:
Just manually edit the position and size of your labels there. You should see the change immediately reflected in the display.
Hope this helps!
Setting no autoresize behavior in Interface Builder solves the issue.

UITableView Gap Xcode 5

I'm having trouble adding a UITableView to a UIViewController in Xcode 5 (DP4). When I add the table view and add a cell to the table through Interface Builder Storyboards, the table adds an extra white gap/space above the first cell. This seems to be happening when I embed the view controller in a Navigation Controller.
When I build and run the space is still there so it's not just a quirk in IB.
See the picture below to see what I mean.
https://www.dropbox.com/s/tgqolwmo02h91d6/Screen%20Shot%202013-08-20%20at%2011.52.27.png
This doesn't happen on Xcode 4.6
https://www.dropbox.com/s/8giyj2mjdhcrhy4/Screen%20Shot%202013-08-20%20at%2012.37.06.png
It looks like the Table View can't be the first child of the view controller's view. Drag it down below another view to fix the issue.
If you want more help, you'll need to go on Apple's developer forum (NDA, blah blah blah), but I'd say have a look at your constraints. Keep a backup of your XCode 4 story and upgrade it in XCode 5, you might see what is wrong.
When you add a UITableView to a blank view canvas it adds a 20 pt constraint to the top to account for the status bar. Embedding the UITableView in a navigation controller after this constraint was already set added this padding to the top of the UITableView. I found this constraint in XCode but no matter what I did I couldn't remove it. What I ended up doing was removing the UITableView from the View and then adding it back and the constraint was gone. The UITableView remained the first child of the view so I don't think that's a specific requirement.

Resources