這是UINavigationController的init方法。我想我一定是做錯了。隱藏在內容後面的導航欄
- (id)init
{
self = [super init];
if (self) {
self.view.backgroundColor = [UIColor blackColor];
self.viewController = [[UIViewController alloc] init];
self.viewControllers = [NSArray arrayWithObject:self.viewController];
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStylePlain
target:self
action:@selector(done)];
self.viewController.navigationItem.rightBarButtonItem = button;
self.navigationBar.barStyle = UIBarStyleBlackTranslucent;
self.mediaScrollView = [[MediaScrollView alloc] initWithFrame:self.view.bounds];
self.mediaScrollView.touchDelegate = self;
self.mediaScrollView.fullScreenDelegate = self;
[self.viewController.view addSubview:self.mediaScrollView];
}
return self;
}
的mediaScrollView會在我的導航欄的前面。它應該出現在導航欄後面。
這是調用它的方法:
self.mediaVC = [[PDMediaViewController alloc] init];
self.mediaVC.mediaScrollView.manualMedia = YES;
self.mediaVC.mediaScrollView.mediaDelegate = self;
self.mediaVC.mediaScrollView.currentMediaItem = 0;
self.mediaVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:self.mediaVC animated:YES];
不繼承UINavigationController的(除非你真的* *知道你在做什麼!) –