开发者

One table view cell/row bigger than others?

I know it is possible to set the height of all rows in a UITable but is it possible to set one row to be bigger than the others. For example when the user touches on the cell with 2 fingers 开发者_开发百科I want the cell to expand and show a description. But only that cell. Is that possible without overlapping the cells below it?


Use the UITableViewDelegate method heightForRowAtIndexPath

Say that your data model stored objects that have a height property:

 - ( void ) changeHeightForRowAtIndexPath: ( NSIndexPath *) indexPath ( NSInteger ) height {
    [ myData objectAtIndex: indexPath.row ].height = height;
    [ myTableView reloadRowsAtIndexPaths: [ NSArray arrayWithObject: indexPath ] withRowAnimation: UITableViewRowAnimationNone ];
 }


Override this method - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath.

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜