Align labels of a custom UITableViewCell when editing - ios

I have an UITableView with several prototype cells and some of the editable cells are basic cells and some customs.
(XCode 4.6.1 / iOS 6.1)
My question is how to automatically align the labels of the custom cells (in the Storyboard) like it's done by default for basic cells' textLabel?
Here's two screenshots to understand what I mean:
By the way, I've obviously Google'd before and didn't find anything but maybe I missed something, as I'm a newbie on iOS :)
Edit: you probably already understood the screens, but in case of: the "add" cell is a default basic cell and the "delete" cells are custom cells with my own UILabel (with the wrong alignment).

Related

How to animate tableview cells constraints when tableview is in and not in editing mode?

What I am trying to achieve is this: I have a tableview with multiple sections but for clarity here we will just say it has one section. When the tableview is not editing, I want the tableview cell to be laid out one way. Then, when the user hits the edit button, I want the tableview cell to look another way. So pretty much I want the tableview cell to look 1 of 2 ways depending upon whether or not the tableview is in editing mode. I already have the tableview cell constraints working fine if it is not in editing mode. So how can I make my cell flip flop between the 2 sets of constraints? I tried removing the old constraints and implementing the new constraints, but for some reason it's not working. It might be because my constraints are wrong, but am I at least going in the correct direction with what I'm trying to complete here?

Tableview within a tableview or autolayout nightmare

Looking for advice from more seasoned IOS dev's. I'm building with swift and autolayout storyboards. I have a cell within a table view that displays a picture and comments.
My problem is that any picture can have zero to several comments. I would like to limit it to two but I am now looking at having a tableview within a tableview cell. My other approach was to just add two comments and set the height to zero if comments for that picture have not been made yet. I started down the tableview within tableview (tableview inception) approach but shifted thinking that Apples autolayout would just pull everything in tight. Sadly tableView.rowHeight = UITableViewAutomaticDimension Turned out to be a layout nightmare and never did work right inspite of my carefully placed constraints. Am I missing a third obvious option. What would be your approach?
You can use view based NSTableView with 2 NSTableCellView.
PhotoWithComments NSTableCellView
WithoutComment NSTableCellView
I think using view based NSTableView would be easy then cell based NSTableView for your problem.

iOS 7+ UITableView with 3 Different Prototype Cells of Varying Height

This should be pretty straight forward, but it appears I need to reach out and ask if others have encountered this...
I've got a project on xcode 6 that's targeting iOS 7+. I'm using a storyboard and autolayout. I've created a UIViewController, dropped on a UITableView, and on that UITableView I've dropped on 3 different prototype cells, each with varying height. Each proto cell has its own UITableViewCell class, with UIElement linked accordingly.
These proto cells are designed in the GUI editor of the storyboard, and each of them have a fixed height. The will never grow in height like this: Using Auto Layout in UITableView for dynamic cell layouts & variable row heights
The problem with all examples I keep finding is that they all use a single prototype cell, and vary the height based on the content (i.e. they're using a UITextView and sizing the cell height based on how much text in in the view).
Since my proto cells are already designed in the storyboard, and they will never exceed their design height with dynamic content, all I want to do is show them as they are designed, when they are added to the table.
I'm using a switch statement in the cellForRowAtindexPath to determine which UITableViewCell class to use based on indexPath.row.
I created some dummy data in an array and use it to build a table with 3 rows, to see each of the 3 types of cells being rendered in the table.
This all works perfectly on iOS8. On iOS7, however, all three of my cells visually end up piled on top of each other.
For grins, I then implemented a heightForRowAtIndexPath method, and simply use a switch to determine what indexPath.row I'm dealing with, and then return back the height of the prototype cell (from the dimensions shown in the storyboard designer). This was supposed to be a simple, hard-coded approach to see if heightForRowAtIndexPath was needed to solve the issue.
Again, works great on iOS 8, but on iOS7 all 3 cells are piled on top of each other.
I guess a basic question is: since I'm using storyboard-designed prototype cells, that have fixed sizes and constraints on all of the UIComponent within those proto cells, why doesn't this work on iOS 7?
I'm trying to avoid adding tons of code just make this work on iOS7.
iOS7 doesn't support self-sizing cells, implementing heightForRowAtIndexPath: and returning the correct height is the right way to do it.
Do you calculate height in "tableView:heightForRowAtIndexPath:" ? Maybe you should try to do it in "tableView:estimatedHeightForRowAtIndexPath:", because being dequeue cells copts from storyboard

Need assistance regarding custom UITableView and custom UITableViewCell

This is screenshot of whatsapp, I have to create a tableview just like this one.
It has space on left side (Dont know top two cell are custom or default with right detail style).
Few cells in between have no separators.
How I am suppose to do same with my uitableview.
Start from iOS 7 left inset of UITalbeViewCell is default. Default value is 15, but you can change it.
This is not a few cells. This is One custom cell. I mean work+main+iPhone it is one cell.

UILabel dynamic height iOS 7 with Views Below

Similar things have been posted a hundred times here at SO, but I just cannot get my specific situation to work.
My specific problem is:
I have a UILabel that gets various amounts of text dynamically from a plist.
This label is inside a prototype cell in a table & I can get the cell to grow according to the amount of content.
I can get the 8 views that are below that cell in my prototype cell layout (two UIImageViews, a couple of other UILabels, and a few UIButtons) to move down based on the size of the dynamic UILabel.
Here's the problem:
When I scroll down to see the full cell on the 3.5" iPhone in the simulator, the cell cuts off before the bottom of the cell, and on the 4" iPhone it is perfect.
When I fiddle with the height of the UITableView in the storyboard, it either cuts off more or not but it never hits the same way in both devices.
Oddly, when I make the tableView shorter in the storyboard, it makes the view longer (and the cell shows up) in both devices.
There's just no rhyme on the space below the last element in the prototype cell, and I can't seem to equalize it at all.
Any help would be appreciated.
I can't believe this is so difficult for me.

Resources