Can't change UITableViewCell size in Interface Builder - iphone

Does anyone have the same problem as I do? ... I've upgraded to the iPhone SDK 3.2 and I am unable to resize UITableViewCell object in my XIB file (usually I've been just resizing the view but now the cell has the same size and there is just a grey are around) ... btw, I've tried to reinstall twice including one deep reinstall.

Hey I had this same issue. This is old, so maybe you found a solution already, but for those who haven't...
Select the cell in IB, and bring up the size panel (by clicking to it or with command-3). Under size & position, set to frame, and edit the height box there.
Easy, huh. Don't know how we missed this.

The tableviewcell size can be set by dragging the cell frame in the interface builder.
Then implement then tableview delegate tableView heightForRowAtIndexPath for the particular cell you want to have a different height.

I have 3.2 installed and don't have that issue. Check that you are returning the correct cell height for heightForRowAtIndexPath. So for a cell at section zero, row zero (that uses a custom UITableViewCell), use the height of the cell defined in the XIB:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 0 && indexPath.row == 0)
return m_customCell.frame.size.height;
else
return 44;
}

first tab (Attributes) -> subtab(Simulated User Interface Elements) -> Status Bar: set(Unspecified) . Worked for me

The accepted answer (selecting the TableCell) and using the inspector did not work for me with XCODE 5.
This worked:
- In interface builder, select the TABLE VIEW (NOT the TableViewCell).
- Then in inspector (Size Inspector), notice at the top "Row Height". Set that as desired.
- Also notice Section Height can be set here too!
Final note, the table cell can definitely be drag/resized as well.

Related

UITableView weird padding at the bottom of cell

I have a UITableView in which I am displaying bunch of custom cells. The cell is configured to be 50 pixels in height:
I am retuning 50 in the heightForRow method:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 50.f
}
But in the end, there's a weird 10-15ish pixel padding/spacing between each cell:
What am i doing wrong?
Thanks!
Without seeing your custom cell's configuration code, I can only guess. The space you see is likely internal to the cell. Perhaps you've added a green subview, but it isn't sized to fit the cell. You probably need to set the subview to have a flexible height (or if you're using Auto Layout, pin the top and bottom to the parent).
Or maybe you have one cell per section and you're somehow creating a blank header or footer.

How to reload and animate specific cell in UITableView in iPhone sdk

In my application, I am using tableview with some rows. In each row I am displaying some part
of text.In that row below text there is a Expandbtn. If we click that we will display the whole
text.
For that I want to use reloadRowsAtIndexPaths: WithAnimation: method . I want to apply this
method when I click Expandbtn in each cell.
I am using that above method for expanding text in cell. My Problem If I expand text in first
and go to 2nd cell it appears to be expanding and it is overlaping with first cell.
If I scroll the table to the top, then first cell appears to be NOT Expanding.
Can Anyone Help me in this.
Thanks in Advance.
Relating to "If I scroll the table to the top, then first cell appears to be NOT Expanding." It sounds like you are not dynamically determining the height of the rows.
Are you implementing the delegate method - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath in your NSTableViewController? If so, make sure you are returning a different value before and after you expand the row.

Text under a UITableView cell

The iPhone's settings application is build around a UITableview. In some views there are additional texts between cells. For example in "Settings" -> "General" -> "Network" there is the text
"Using 3G loads data faster, but may descrease battery life" under a cell with an UISwitch. Any ideas how to implement this?
Images of what I mean can be found here:
http://www.tipb.com/2008/07/12/how-to-disable-3g-on-the-iphone-3g-for-more-talk-but-less-speed/
If you have a grouped table view, the tableView:titleForFooterInSection: method found in the UITableViewDataSource protocol and the UITableViewController class handles this for you:
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
if (section == 0) {
return #"Footer text for first section, goes below cells in that group.";
}
return nil;
}
To place that text between cells, you have to have multiple sections and tell your tableView:cellForRowAtIndexPath: method to place cells that you want beneath that text in the next section.
In XCode 6.1 you can specify footer text for Table View Sections in the Story Board.
Select your TableViewControler in the Story Board, then select the TableViewSection that you want the footer on. Then in the Attributes Inspector, in the Footer field, enter your text.
You can also create your own UIView of any type (images, texts etc) and add them to the table cell, by using the [[mycell contenView] addSubView:WHATEVER_IS_MY_VIEW_TO_ADD];

Decrease UITableViewCell width and put custom button on the left

Is there any way to decrease the standard width of grouped UITableViewCell and put a custom button on the left side(outside of cell boundary)? I tried to change the cell size but it keeps same
You are going to have to fake the editing mode.
What I mean by that is that as AtomRiot said you have to subclass UITableViewCell so that when in editing mode you show the button you want on the left, outside the cell.
But first things first.
To change the indentation level for your cells all you need to do is implement this delegate method for the UITableView
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
So that takes care of it. Then in your UITableViewCell subclass all I would do is to implement the method
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
which I assume is called when the table the cell belongs to has changed to editing mode.
There I would fade in (or animate in any way you want) a button to appear on the left of your cell.
I have done it inside a grouped-style cell but never on the outside.
Give it a try!
You could subclass UITableCell and add your own custom views inside of it. I have not personally added a button inside one but it should work. It may get confused with the row selected call the tableview makes if you are implementing that.
The Cocoanetics blog seems to have a pretty good solution to this:
http://www.cocoanetics.com/2010/03/how-to-shrink-cells/

UITableViewCells with different cell sizes

Is it possible to have a UITableView that has a fixed height for all cells, except for the cell at the top (index 0)?
If so, how is this possible?
You have to set the tableView’s delegate to an object that responds to tableView:heightForRowAtIndexPath:.
If your topmost cell does not have to be a UITableViewCell, you can also use a section header instead of a cell. See same protocol.
I don't know about your app, but you might want to have a look at tableHeaderView instead of trying to change the top row. Here's a link