-----------------| Status bar | -----------------| Nav bar | -----------------| Custom VIEw | -----------------| || VIEw Controller || | -----------------
我正在使用我的CustomVIEw(UIVIEw)设置框架,如:
- (ID)initWithNavigationController:(UINavigationController *)navController { self.navController = navController; return [self init];}- (ID)init{ CGRect vIEwFrame = self.navController.vIEw.frame; return [self initWithFrame:CGRectMake(vIEwFrame.origin.x,self.navController.navigationbar.frame.origin.y + self.navController.navigationbar.frame.size.height,vIEwFrame.size.wIDth,40.0)];}
这是解决这个问题的方法吗?
解决方法- (ID)initWithNavigationController:(UINavigationController *)navController { CGRect vIEwFrame = navController.vIEw.frame; if (self = [super initWithFrame:CGRectMake(vIEwFrame.origin.x,navController.navigationbar.frame.origin.y + navController.navigationbar.frame.size.height,40.0)]){ self.navController = navController; } return self; }
然后
CustomVIEw* _myCustomVIEw = [[CustomVIEw alloc] initWithNavigationController:navigationController];[navigationcontroller.vIEw addSubvIEw:_myCustomVIEw];总结
以上是内存溢出为你收集整理的ios – 向UINavigationController添加自定义视图全部内容,希望文章能够帮你解决ios – 向UINavigationController添加自定义视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)