开发者

UITableViewController cell design issue

I have a UITableViewController with an attached xib file. Inside the xib file i have a TableViewCell object with a view inside it along with labels on the view. Below is an image of what my result should be:

pic1 http://casperslynge.dk/2.png

And below is how my tableview is looking atm.

pic2 http://casperslynge.dk/iphone1.png

My issue is that I can't get the table view cell to fill the entire window. Have tried everything inside the interface builder. Nothing to do with the origin or the width/height. Below is how I instantiate my cell with the xib file and fill my labels with data.

- (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;

}

The weird thing is that in the next view when one of the cell's are pressed, I have no issue making the view fill the entire width and height, and it is created in exactly the same way (see picture below). Is it something in the xib file that I am doing wrong or in the code?

pic3 http://casperslyn开发者_Go百科ge.dk/iphone2.png

Can anybody help?


As I see from screenshots you are trying to use table view with grouped style while you definitely need a plain one (at least for first view).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜