我有一个附带xib文件的UITableViewController。在xib文件里面,我有一个TableViewCell对象,里面有一个视图以及视图上的标签。下面是我的结果应该是什么样的图像:UITableViewController单元设计问题
pic1 http://casperslynge.dk/2.png
而下面是我的tableview是怎么找ATM。
pic2 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文件中,我做错了或在代码中的东西?
pic3 http://casperslynge.dk/iphone2.png
任何人都可以帮忙吗?
[UITableView单元设计问题]的可能重复(http://stackoverflow.com/questions/7476330/design-issues-with-uitableview-cells)。你应该回去编辑你原来的问题,而不是发布一个新问题。 – Perception
对不起。那么只需删除另一个。 –