bencallis
bencallis

Reputation: 3657

UITableViewController Xib not being used in iOS5 (working in iOS 6)

I have several ViewControllers which subclass UITableViewController and have a Xib file where I set the TableViews appearances (style, colours etc) and add a header and footer.

There xib files do not appear to be getting loaded on iOS 5. On iOS 6 the xib is loaded and the view looks as expected.

iOS 6

enter image description here

iOS 5 iPad iOS 5.1

Xib - Interface Builder

enter image description here

Any ideas?

Upvotes: 0

Views: 364

Answers (2)

S3B
S3B

Reputation: 1

Thank. It's OK for Me

i add a method 'initWithMyNib' i replace 'initWithStyle' with 'initWithMyNib'

(id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self)
    {
        // Custom initialization
    }
    return self;
}

(id)initWithMyNib:(NSString*)strNibName
{
    self = [super initWithNibName:strNibName bundle:nil];
    if (self)
    {
        // Custom initialization
    }
    return self;
}

Upvotes: 0

bencallis
bencallis

Reputation: 3657

Turns out that prior to iOS 5 the UITableViewController designated initialiser did not load the Nib. This changed with iOS 6 and it now checks for a Nib.

To make the app work with both version I have made my designated initialiser call

self = [super initWithNibName:@"Nib Name" bundle:nil];

Upvotes: 1

Related Questions