Table cells scroll past table boundaries iphone ipad - ios

I have searched all over but have not found any answers or even a question like this. I have a UITableView. When I load the table everything seems ok. However, when I start scrolling vertically the cells go past table boundaries on both top and bottom of the table. In case of the top cell, it only disappears off the screen once the bottom of the cell reaches the top of the table. Same thing happens on the bottom of the table. See image below. This happens in both iPhone and iPad app. Any help would be greatly appreciated!

Try setting:
tableView.clipsToBounds = YES;

Related

Xcode UITableView image does not align properly on simulator

I am working on a project on Xcode7.3 using swift using autolayout. I am stuck with an problem with the UITableview not displaying properly on the simulator.
I created a ViewController and dragged a TableView into ViewController. Then I dragged a UIView and UIImage ontop of that TableView (To display as a header image). I also dragged a UIImage onto the prototype cell. They are all aligned in the center horizontally and vertically. However, when I run the app, they don't show in the middle of the screen.
As shown in the UITableView_Problem Image, the images are offset to the right. What is also weird is that when I rotate the screen, the scrollbar on the right does not go all the way to the right. The images appears to be in the center of the screen if I consider where the scroll bar is the end of the screen. But that doesnt make sense because the bottom bar items spans the full width of the screen.
However, if I create a UITableViewController from the story board instead of dragging a TableView onto a ViewController, I do not have a problem at all. (Image3)
It is frustrating because I wanted to add a text field for keyboard at the bottom of the screen just like the comment section in Instagram app. And after hours of searching, it appears that the only way to do that is to drag a tableView onto a ViewController. i stack imgur com JC5Pw png
Could anyone please assist? Much appreciated
Blockquote
note: I dont have a developers account yet so I cant check on an actual device
You are designing your interface in the wRegular/hRegular (or universal) size class. You will need to be very good about your constraints or develop a layout for the wCompact/hRegular size class for iPhones in portrait mode. You can change this by selecting here the blue part on the bottom of your storyboard
Thanks Dan for your prompt response! I added constraints to everything except for the tableView. Dont know what I was thinking as I have been troubled by this bug for a few days. Everything works fine after the tableView constraints was set!

Animating a UICollectionViewCell to take full width while pushing adjacent cells off screen

I'm using a UICollectionView with a UICollectionViewFlowLayout to display a grid with 5 columns.
What I need to do now is to make it such that when someone taps on a certain cell, that cell expands horizontally (until it takes the full width of the screen). The cells to the left and right of it should get pushed off the screen.
A great example of this behaviour is in the Siri Contact Suggestions on the search screen of your iOS 9 devices.
Siri Contacts Suggestions
At this point, I have no clue what the best approach to do this is so I would appreciate if you could point me to the right direction.
Cheers

xcode - TableView rows from bottom to top

For my little project, I need you help.
I already created a functioning table view. Now I want that the rows goes from bottom to top and not like usually from top to bottom. How do I do that?
First you rotate your UITableView 180 degrees upside down, and then rotate your individual cells also upside down.
Take a look: UITableView anchor rows to bottom
If you can target iOS 6+, this answer suggests using UICollectionView to lay out rows in reverse order: https://stackoverflow.com/a/23895000/144088.
The most simple solution,
you can use array.reversed() to show the last object of the array at the top of tableview

I've added a view within a UITableView and there is a gap between the view and the first cell. How can I remove it?

I've added a view to a tableView and there is a gap between the view which is 44px high and the first cell.
Here's a screen shot from IB:
I've tried a few things such as changing the heightForHeaderInSection's value and also disabled adjust scroll view insets. None of these work properly. The view seems to be within the tableView and scrolls with it.
This is how things are looking in simulator:
Would appreciate some help here as I don't understand what exactly is causing this gap.
Thanks for your time
A great way to debug these types of problems is to set a background color. You could set the cells to red and the view to green. It would then be interesting to see if the red and green edges are flush with no white in between.
Based on your screenshot, it looks like nothing is wrong. And by that I mean it looks about right for a view height of 44 points and a cell immediately beneath it with no separator line above it (so it's hard to tell where one ends and the other begins).

Detail Text and Accessory Don't show [duplicate]

I'm trying to use Auto Layout for a custom Table View Cell in my app.
I can't seem to get the constraints quite right.
I layed the labels out in the custom Table View Cell, but the labels are still getting cut off. Any ideas?
Thanks! Will post anything else needed. Tried to show needed info in picture below:
Debugging in Xcode. Somehow what shows in Simulator looks different than in Xcode debug.
Here's the width of my TableView shown:
UPDATE:
The problem here was related to what user matt said in the accepted answer, but I wanted to make the Q&A a bit clearer now that I have it figured out for anyone else that comes across this.
In his initial comment, he mentioned the Xcode View debugging, which was great and I was able to dig into a little bit more. Its called the Assistant Editor: Device Preview, where you are able to see the layout and layers of what is onscreen to see if maybe you have labels overlapping or going offscreen based on the device it is running on. If you want to check multiple device sized, just hit the plus icon in the lower left hand corner of this picture.
This helped me find overlapping layers and sizing issues with the TableView. I was able to see how it looked on each device size.
What also helps here sometimes to use the Pin menu. Sometimes the labels can run off screen because it doesn't know where the constraints of the cell are based on the device size. So your label can run offscreen if the label is based off of a landscape layout but the device is an iPhone 5 and is in Portrait for example. This is the Pin menu:
Hope that makes sense and gives some more color to the problem. Let me know if you have any questions at all, thanks for the help everyone!
The problem is that you are using auto layout but you have not done anything about sizing the table view. The table view here is not your view controller's view; it is a subview. Your view controller's view is automatically sized to the size of the device / window, but its subviews are not automatically resized. So you are ending up with the table view much too wide for the device; the whole table is sticking off into space on the right side.
Use a trailing space from the right side of your labels to the edge of their superview, and set it to greater than instead of equals with a value of ~ 5
Review the constraints of your tableview with the View. Draw cell border, label border and tableview border with different colors to know which elements do not display correctly.
Ex:
#import <QuartzCore/QuartzCore.h>
...
cell.layer.border.width = 1;
cell.layer.border.color = [UIColor blackColor].CGColor;
The thing that worked for me to solve views being clipped was to uncheck "Constrain to margins" in Auto Layout.

Resources