[英]IOS8 UiTableViewController grouped tableView like iOS6 style wrong left right margin
[英]Add left and right margin to tableview of UITableViewController
我有静态单元格的UITableViewController的tableview。
现在,我想在运行时添加左右边距约束,因为无法使用Interface Builder添加约束。
谢谢
您可以将UITableView而不是UIViewController嵌入到UIView中。 如果这样做,则可以调整表视图的大小并在界面构建器中设置边距。 创建一个新的UIViewController(一个不包含UITableView的UIViewController),然后将一个新的UITableView拖到其上。 记住要设置数据源并将其委托给新的UIViewController。 那应该做。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if(indexPath.row==0){
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = @"your text";
return cell;
}
if(indexPath.row==1){
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = @"your text2";
return cell;
}
等等...
不确定但可能是-tableView的scrollview插图可以帮助您-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.