Xcode 添加三个子视图,每个都带有Navigationcontroller?
您好,我创建了三本书(UIView),每本书都有自己的用于分页的Navigationcontroller。 我的问题 !)使用三个Navigationcontroller有意义吗 2) 我的代码在下面好吗?这似乎是可行的,但酒吧有一个20像素的顶部设置Xcode 添加三个子视图,每个都带有Navigationcontroller?,xcode,subview,navigationcontroller,addsubview,Xcode,Subview,Navigationcontroller,Addsubview,您好,我创建了三本书(UIView),每本书都有自己的用于分页的Navigationcontroller。 我的问题 !)使用三个Navigationcontroller有意义吗 2) 我的代码在下面好吗?这似乎是可行的,但酒吧有一个20像素的顶部设置 #import "Book_01.h" @implementation Book_01 // UIViewController @synthesize book_01_NavigationController; - (id)initWith
#import "Book_01.h"
@implementation Book_01 // UIViewController
@synthesize book_01_NavigationController;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
[self.view addSubview:book_01_NavigationController.view];
}
return self;
}
伙计,你的密码没问题。但是,您需要首先声明导航控制器:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
book_01_NavigationController = [[UINavigationController alloc] initWithRootViewController:self];
[self.view addSubview:book_01_NavigationController.view];
}
return self;
}
从顶部开始大约20像素。那是因为你的状态栏是隐藏的。您需要将元素调整为全屏显示
[]的伙计,你的代码没问题。但是,您需要首先声明导航控制器:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
book_01_NavigationController = [[UINavigationController alloc] initWithRootViewController:self];
[self.view addSubview:book_01_NavigationController.view];
}
return self;
}
从顶部开始大约20像素。那是因为你的状态栏是隐藏的。您需要将元素调整为全屏显示
[]的