[英]UITableViewController cell design issue
我有一个带有附加xib文件的UITableViewController。 在xib文件中,我有一个TableViewCell对象,其中带有一个视图以及该视图上的标签。 下面是我的结果应该是的图像:
图片1 http://casperslynge.dk/2.png
下面是我的表视图如何看待atm。
图片2 http://casperslynge.dk/iphone1.png
我的问题是我无法使表格视图单元格填充整个窗口。 尝试了界面生成器中的所有内容。 与原点或宽度/高度无关。 以下是我如何使用xib文件实例化单元格并用数据填充标签的方式。
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString * CompanyListCellIdentifier =
@"CompanyList";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CompanyListCellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CompanySubscriptionView" owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
}
NSUInteger row = [indexPath row];
CompanyModel *company = [list objectAtIndex:row];
name.text = company.name;
network.text = company.networks;
NSString* subscriptionCountString = [NSString stringWithFormat:@"%d", company.subscriptions.count];
subscriptionCount.text = subscriptionCountString;
fromPrice.text = company.fromPrice;
NSString* trustScoreString = [NSString stringWithFormat:@"%d", company.trustScore];
trustScore.text = trustScoreString;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
奇怪的是,在下一个视图中,当按下一个单元格时,使该视图填充整个宽度和高度没有问题,并且它的创建方式完全相同(请参见下图)。 是xib文件中我做错的事情还是代码中有问题?
图片3 http://casperslynge.dk/iphone2.png
有人可以帮忙吗?
正如我从屏幕快照中看到的那样,您正在尝试以分组样式使用表格视图,而您确实需要一个普通样式(至少对于第一视图而言)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.