Reputation: 17
NIB file is loaded successfully in my scrollView but sounds like it's class is totally ignored as if the xib is not associated with it, i checked that by accessing the class direct and its working fine showing all the NSLogs in viewDidLoad and UILable.text = @ ...etc.,
But after loading the same xib i can't see but a dead interface
Asking after a whole day of searching on this issue. Thanks in advance for you super guys
Loading Nib by: ( in Setting.m )
NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@"SettingProfile" owner:self options:nil];
UIView *settingA = [nibViews objectAtIndex: 0];
[ScrollView addSubview:settingA];
SettingProfile.h
@class SettingProfile;
@interface Setting UIViewController {
SettingProfile *SettingProfile;
}
@property (nonatomic, retain) SettingProfile *settingProfile;
Upvotes: 1
Views: 1087
Reputation: 17
Partially solved, to those whom facing the same problem just add the loaded Nib name in the owner:
NSArray *nibViews = [[NSBundle mainBundle] loadNibNamed:@"SettingProfile" owner:@"SettingProfile" options:nil];
UIView *gridView = [nibViews objectAtIndex: 0];
[ScrollView addSubview:gridView];
Still trying to connect the outlets in the loaded Nib/class correctly, i know connecting it with the same file owner is wrong causing app crash.
Upvotes: 0
Reputation: 11818
It looks like you are loading the Nib into a UIView which may not be the result you are looking for... I use the nib loading in my Table View... Perhaps this snippet will help you
OfferCell *cell = nil;
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"OfferCell" owner:self options:nil];
cell = (OfferCell*)[nib objectAtIndex:0];
I then do whatever I want with by cell.
Including add it to the tableView...
When I retrieve it I cast it into the OfferCell object again.
Upvotes: 2