Overlapping section names in UITableView in Swift - ios

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.

Related

Xcode messed up constraints and auto layout after reloading project

I have a static table (UITableViewController) with few cells , its a data entry form basically, when i created this and put all the constraints all was good until i reloaded the project , now all the components are outside of view and entire layout is messed up along with constraints. This has happened twice and i have no idea why this is happening
I deleted entire project and pulled it from repository , but still its same
important thing is this runs fine inside app, shows the correct screen , so looks like this is some Xcode rendering specific issue,also this it not happening with some other screens in project, I have tried deleting tableviewcontroller and adding it thrice but same result.
This TableViewController is linked to a UIViewController which has collectionview upon taping one of the collectionview cell this view gets laucnhed and hence linked though a show segue.
****** edit ***********
Figured it out , this happens especially when i add height and width constraints to the label and textfield
ok here is how i solved the issue ,
I found out that if i add height constraints on controls inside a TableViewCell then it would mess up the design, thus not adding height constraints and instead managing with top and bottom spacing helped. Still not sure why this is happening to only certain TableViewController and not all.

Interface Builder is not letting me delete a button

To clarify: I have a view/vc which is designed as an orphaned scene in IB in the storyboard it is used within. This view has a button with an image, a height and width constraint, a left and top constraint. There is a table below it with top, left, bottom, right constraints set to 0. A seperate VC loads this view, sets its width to half the screen and animates it coming in and sets its delegate.
All's honky dory. Now, we wanted to edit the sizing of the button and some miscellaneous things. I noticed the constraints seemed to not be getting applied in simulator. I then, after a while of playing with constraints and losing my mind, decided that maybe something more fundamentally wrong was occurring so i decided to delete the button and see where the table below it is getting placed with it's constraints set.
Then, nothing. The button is still there. I have looked to see if I accidentally c/ped it, and I have not. Is this a known bug?
Clean the project and delete the app on simulator.

TableView and CollectionView position & size automatically gets change in Storyboard in iOS

I have searched alot but found nothing on this issue.... :(
I have added a CollectionView and two TableView in a storyboard.
Every thing was working perfectly fine.
Now the Problem is both TableViews and CollectionView is automatically gets change their position & size and moved in storyboard's left upper corner.
Almost hide themselves.
When i drag them one by one and change layout / position, they again change their position and size when i select any other object(Button/Label) on storyboard.
Here is the Screen shoot i just take of my storyboard.
I have removed / deleted the storyboard and congifure it again from start but the problem is same :(
what is this all happening.... I don't know what to do here?
Please help me on this issue.
CollectionView is just behing that misplaced TableView in storyboard's left upper corner.
Haven't worked much with XCode version 6, but this issue maybe arising due to AutoLayout or the new view size properties introduced in Xcode 6 & above. Try disabling AutoLayout.

Scroll bar doesn't reach the end of the tableview

I don't know exactly why, but the scrollbar of my tableview never reaches the end.
This is the middle of the tableview, everything looks fine
But when I reach the end
The scrollbar doesn't reach the end...
I guess my constraints are ok (I'm using autolayout), because besides the scrollbar, the tableview is well displayed.
My view controller is a UIViewController and contains only a UITableView. Here is a screenshot that sums it up :
No constraint is added by code. Do you know how could I debug this?
Thanks in advance
Edit : I have tried to delete and recreate the view controller (by copy and pasting the UITableView) the problem is still here.
Edit2 : If I change the bottom constraint to "Bottom of the view" instead of "Bottom layout guide", this works well.
The problem is that my view doesn't have a correct height, because it is supposed to go under the tabbar.
Any ideas ?
I've fixed the problem by settings the property automaticallyAdjustsScrollViewInsets to NO.
More details could be found here:
https://stackoverflow.com/a/21302259/1295537
What could be happening is you have clipping disabled, and the frame for your tableView isn't the entire height of the view.
Or, you could have contentInsets set, which changes the size of the scroll indicator as well.
For those who the above solutions don't work, try this. It makes no sense tho, but it works (In my case I needed the UITableView to behind other views, so I just added a dummy view)
https://stackoverflow.com/a/23019724/1148910
Instead of using a normal View Controller and dragging in a tableview in a storyboard (which I assume you're doing), have you considered using a Table View Controller? You shouldn't have this problem in that case (I never have). You can easily embed the Table View Controller in the Tab Bar Controller.
Hope this helps!

UITableViewCell incorrect X positions

I've been searching through here and googling like crazy for a possible solution to this problem. Thus far I'm turning up exactly nothing that actually fixes it so I'm hoping someone can help.
I'm working on the UI for a iPad app. I'm doing it using interface builder. I worked with storyboards briefly but I don't like them all that much so I'm sticking with IB for now. Unfortunately I'm not very experienced with the workings of IOS Ui but it's been going relatively smoothly so far. In my app, I have a view controller, which holds a view containing a pair of sub views. One subview contains a rather windows like header bar (i like the look). The second contains a UITableView. The UITableView is set up properly as far as I can tell, and feeds it's info from a data source using custom UITableViewCells. The UITableView is set to grouped though currently there is only one section. The table is in edit mode by default because I want the user to be able to add new items and use the VC as a selection dialog. The view controller is presented (rather than pushed) using UIModalPresentationFormSheet (again, because I like the view) but I don't know that has any bearing on the problem. The cell border is flush with the X origin, the only reason the text isn't currently starting there is because I went into my cell and move the label over, leaving a gap between the edge of the cell and the label containing my text.
The Offending View http://bit.ly/144cbjT
The Problem: The UITableViewCells, for some reason are positioning themselves at X: 0. This puts them outside the border drawn on the UITablewView when you set it to grouped style. I could probably just turn off the border and get away with it, but I like the look so i want to keep it. I've tried messing around with constraints and anchor points on the cells, the content of the cells, the table itself, the view... I've tried simply moving my cell's labels over a bit. I've also had clipping subviews turned on and off. I've made sure the controls are being loaded properly from the XIB. I've made sure everything is added as a subview where needed. I've made sure I've tried everything I could think of short of setting the cell's X position in code. But since I'm not sure how to tell where the border is, I'd rather have the tableview or the cell do the work itself.
The question: How do I fix this? The selection accessory should be outside the grouping box. The text should be inside, not bleeding out onto the background like it is.I believe the content of the cell should be displayed inside the border within the yellow area.
The odd thing is, this is my fifth or sixth table in this app and I've been doing them all basically the same. Thus far this is the only one I've had trouble with.
Can anyone shed some light as to what's going on?
Thanks in advance
I think that to get this in code, you'd have to do something explicit, so the most likely candidate is a messed up IB file.
Since it doesn't cost anything, I'd just delete the tableView from the IB and then re-add it. If that doesn't work, try recreating the complete IB.
Hope that helps

Resources