I have a UIViewController calling another view Controller with a defined loadView method. I’ve been trying many options without success to solve the problem of the loadView method not called.
Any help is appreciated.
Thanks. MArcos
Caller UIViewController
#import "MyAlbumViewController.h"
@interface ViewController : UIViewController
@end
implementation
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidAppear:(BOOL)animated{
UIViewController*albumVC = [[MyAlbumViewController alloc] init];
[self.navigationController pushViewController:albumVC animated:YES];
}
@end
Called UIViewController
@interface MyAlbumViewController : NIToolbarPhotoViewController <NIPhotoAlbumScrollViewDataSource>
@end
Implementation
#import "MyAlbumViewController.h"
@implementation MyAlbumViewController
- (void)loadView{
[super loadView];
self.photoAlbumView.dataSource = self;
// Set the default loading image.
self.photoAlbumView.loadingImage = [UIImage imageWithContentsOfFile:
NIPathForBundleResource(nil, @"NimbusPhotos.bundle/gfx/default.png")];
self.title = NSLocalizedString(@"Loading...", @"Navigation bar title - Loading a photo album");
[self loadAlbumInformation];
}...
The idea of
loadView
is to completely override the method, and not callsuper
What you are doing is exactly what the
viewDidLoad
method is for, it doesn't matter if you loaded it from a nib file or whateverAnd I quote from your own post, in your
ViewController.m