1
votes

So I'm finally biting the bullet and jumping into the constraint nightmare that is integrating your nibs to ios7. I've managed to get contraints and whatnot figured out, however I'm getting some weird display problem with tableviewcells with custom images. See here:

ios6: ios 6 table

ios7: ios7 table

Here's my code declaring the bg:

    + (UIImage*)yourTurnCell {
      if (sYourTurnCell == nil) {
        UIImage *i = [UIImage imageNamed:@"YourTurnCell.png"];
        sYourTurnCell = i;
      }
      return sYourTurnCell;
    }

And within my cell structure function:

    self.backgroundView = [[UIImageView alloc] initWithImage:
    [GameListCell yourTurnCell]];
    self.selectedBackgroundView = [[UIImageView alloc] 
    initWithImage:[GameListCell yourTurnCell]];

Width of the table determines width of the rows, which is done in the nib file.

Anybody have any idea how I fix this problem? Everything is 298px wide, but for some unknown reason on ios6 I'm getting the cells smaller than everything else, even though the images themselves are 298px.

1

1 Answers

0
votes

So I wasn't able to fix this problem, but I did find a workaround. I simply built a separate nib for 3.5 and 4 retina screens. Also included an iPad one. With using a nib on it's own I was able to build it properly from scratch without a stupid weird glitch.

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{

CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 480){
    // Retina 3.5
    self = [super initWithNibName:@"SettingsViewController~iphone" bundle:nibBundleOrNil];
}else if(result.height == 568){
    // Retina 4
    self = [super initWithNibName:@"SettingsViewController~iphone5" bundle:nibBundleOrNil];
}else{
    // iPad
    self = [super initWithNibName:@"SettingsViewController~ipad" bundle:nibBundleOrNil];
}

return self;
}