我有一个 UIViewController 使用定义的 loadView 方法调用另一个视图控制器。我一直在尝试许多选项,但没有成功解决 loadView 方法未调用的问题。
任何帮助表示赞赏。
谢谢。马科斯
调用者 UIViewController
#import "MyAlbumViewController.h"
@interface ViewController : UIViewController
@end
执行
#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
调用 UIViewController
@interface MyAlbumViewController : NIToolbarPhotoViewController <NIPhotoAlbumScrollViewDataSource>
@end
执行
#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];
}...