我正在使用此Tutorial来开发应用程序设置屏幕。问题是我想在设置屏幕中增加单元格的高度。我没有采用任何表格视图我通过使用Root.plist文件.ie我想在此Image中增加Legal字段的高度(应用程序设置屏幕不在应用程序的表格视图中)
答案 0 :(得分:1)
首先,您需要保存选定的indexPath行:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.selectedRowIndex = [indexPath retain];
[tableView beginUpdates];
[tableView endUpdates];
}
然后,当您拥有当前选择的索引时,您可以告诉tableView它应该为该行提供更多空间。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//check if the index actually exists
if(selectedRowIndex && indexPath.row == selectedRowIndex.row)
{
return 100;
}
return 44;
}
这将返回所选单元格的高度100。您还可以查看this
答案 1 :(得分:0)
在UITableView
中使用此设置行高- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// Return the height For Row.
return 100.0;
}
答案 2 :(得分:0)
从图像中可以看出,需要增加行高的indexPath是第1部分和第0行:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath *indexValue = [NSIndexPath indexPathForRow:0 inSection:1];
if (indexValue == indexPath)
return 100.0;
else
return 44.0;
}