iOS9 / Xcode 7 Custom Cell Label Alignment Issues - ios

I am having an issue with layouts in custom cells in Xcode in my iOS app since it updating to Xcode 7 and iOS 9 SDK.
On the example screenshot below, the custom cells that I have created with labels inside them are not aligning to the correct default inset/indent that the normal non-custom cells are at.
Specifically as you can see below, the cells in Section 1 are all very close to the left edge (custom cells), as is Cell 0 in Section 2 (Online label is too snug, and the switch is too far to the right), whereas Cells 1-3 in Section 2 (normal default style cells) have the correct default ~15px indent.
Previously it worked correct in iOS8 with Xcode 6.x, but not after the update....how can I solve this?

I found that this issue can be solved by using the accepted solution for this question here! Good luck and happy coding!
UITableViewCell with autolayout left margin different on iPhone and iPad

Related

Content of static table view cell not displayed iOS 9

I'm using xcode 7 beta with iPhone 5s (is beta).
I create a table view (static, grouped, 1 section, 3 rows). Rows B and C are basic style and row A is custom with a label.
On my iOS 9 device row A doesn't display any content, but rows B and C are displayed as expected. If I use another device with iOS 8, row A displays the content correctly (my label with text "A").
Other questions here do not match my problem...
What's the Problem with iOS 9?
Or is it a bug?
Click to enlarge
It's too late to reply but I would like to explain what worked for me. I had the same problem custom cell was not displaying the content of the UITableView.
Just to check where is the problem:
First uncheck Use size classes checkbox and run the project, now you are able to see the content in the custom cell. check again the use size classes checkbox and build the project.
How I fixed: I was working with size classes "width: compact, height: any". So I checked Any:Any in storyboard for custom cell and fixed the constraints and then again I selected "width: compact, height: any" in storyboard and build the project. Now custom cell is desplaying the content.
Note: I am using Xcode 7.3.1

UITableView rendering differences between iOS 6 and iOS 8

I am in the process of updating an old app from XCode 4.6 to 6.3 and have run into a difference in how my custom table view cells are rendered between iOS 6 and iOS 8 (well the change can be seen in iOS 7 as well).
Here are 2 screen shots from Xcode 4.6/iOS 6.1 simulator:
Here are the equivalent Xcode 6.3/iOS 8.1 simulator:
(As background, the Preferences screen is a grouped UITableView with 3 groups and 1 element per group. The Units screen is a single sectioned UITableView with 3 elements. And the "Note" on the Units image is just a plain view)
The difference I didn't expect (and don't like) is that in iOS 8, the custom table cells have expanded horizontally to cover the entire width of the screen, and have also lost their rounded corners.
I have been looking around to see if/how I can make the iOS 8.1 version look more like the 6.1 version, but so far have failed.
Is it possible to easily get back the layout I want? And if so, where should I be looking to make changes?
One possible approach is to set tableView.backgroundColor and your custom cell's contentView.backgroundColor to clearColor (it can be done via the interface builder as well). Then add a background view to your custom cell. You can give it rounded corners and add space around it.
This is what it looks like at runtime (the blue background belongs to the view behind a tableView):
This is more tricky though when we deal with a group of cells on your right screenshot. There the first cell has to have rounded corners at the top, the last one has to have rounded corners at the bottom, and the middle one shouldn't have rounded corners. I guess, it can be done (you could take indexPath into account when configuring the cell), but it takes a bit more work.
P.S. I'm sorry for the size of images. I don't know how to restrict it.

How can I change the size of UI Collection View cells depending on whether it is iPhone or iPad

After creating a universal app on Xcode 6, I have managed to create a UI collection view which displays 2 cells in the width of an iPhone. However when viewed on iPad, it shows 4 cells with lots of padding around the cells.
How can i change the size of cells on an iPad so that 3 cells are shown with minimal padding. I want to leave the iPhone size alone.
So far i have used the storyboard to set the cell size. I have a added a custom cell size of 158pts by 158pts which works perfectly with iPhones. I cannot find this code in the Objective C code. How can I set an individual different size for iPad.
This is what it looks like on iPhone.
https://www.dropbox.com/s/md1sn4z3k78i5s1/iphone.png
and this is what it currently looks like on iPad. The wrong way.
https://www.dropbox.com/s/0x2n9i8v6gvlfnc/ipad.png
I want to get rid of the Grey padding and increase the cell sizes so there are only 3 cells with the same padding as on the iPhone version.
I am a real beginner so any help is much appreciated.
I am answering my own post as I believe that the only way to do this is to use a standard ViewController and place a UICollectionView on top. This way you can add different UICollectionViews for the different Size Classes on Xcode 6.
At this point you can set different sizes for cells on iPad size classes to iPhones ones.
There maybe an easier way to use a UICollectionViewController but i am unaware of it, please let me know below.
EDIT
I have since found out this can be completed using the UICollectionViewController by using constraints and by increasing the cell when used on iPads by code.

iOS 7.1 beta5 tableviewcell height showing objects outside it's range

I have an app that has a list of UITableViewCells. By default, the cells are set to a certain height (lets say 100) to show only some basic information. When the user clicks on a cell the height changes to 150 to show more actions that were previously not seen. This works without a problem on iOS 7.0.0-7.0.5. I'm testing on an iPhone 5s running iOS 7.1 beta 5 and seeing some drawing issues with the cells.
Here's how it looks on iOS 7.0... versions which is what is expected. When the cell is collapsed, the buttons that are positioned past the height of the cell are hidden and when the cell is expanded to a height to show the buttons, they are visible.
Cell expanded:
The following is the cell when collapsed:
Here are the issues I'm seeing with iOS 7.1 beta. Im curious if this is just something that is a problem with the beta or if I'll have to rethink how this is being coded currently. As far as I can tell this has been present since the first beta of 7.1.
As you can see, the button which was previously hidden is now still showing even though the cell is collapsed.
Is this an issue with the beta that anyone else has seen or is this expected behavior now? Thank you for you help!
Try setting clipsToBounds=YES in your cell as it may be drawing outside of it bounds.
cell.clipsToBounds =YES
Also check that the cell height is actually collapsed.

How to make the cell wider in iOS6 iPad

I have an app which was designed for iPad and iPhone. For iPhone everything is ok but in iPad version for the iOS6 platform there is an extra space from the left and right sides of the cell - in iOS7 it's ok. You can see them in storyboards on the next screenshot:
and the sizes for the cell:
How can I remove this extra space ?
There is little changes between IOS 6 & IOS 7 for the UITableView grouped(UITableViewCell):
IOS6 :
cell.contentView and cell.view is totally different with their frames .
IOS 7 :
Cell.ContentView is nothing but the Whole View of the Cell .
IOS 6(VIEW):
If you still wants to do with your thought then make it as Plain Style for UITableView OR by Subclassing the cell.
NOTE: This is not an answer for your question. Its just the way to suggest
Are you using table type group ?
Try changing the UITableView type from group to plain.

Resources