以编程方式为UIAbbarController创建UIView
嗨,我有一个带有5个选项卡项的UITABBARC控制器。 第四个是UIScrollView 第四个选项卡显示的区域我不希望有特定的高度 所以在这之前我已经做到了 这是我创建UITabBarController的地方。(aViewController.h) 如果我使用Xcode创建UIViewController的viewController子类并将其放入NSArray中,没有问题,但我希望我的视图具有screen.height-tabbar.height,因此我尝试通过编程创建一个。 需要任何帮助以编程方式为UIAbbarController创建UIView,uiview,uitabbarcontroller,Uiview,Uitabbarcontroller,嗨,我有一个带有5个选项卡项的UITABBARC控制器。 第四个是UIScrollView 第四个选项卡显示的区域我不希望有特定的高度 所以在这之前我已经做到了 这是我创建UITabBarController的地方。(aViewController.h) 如果我使用Xcode创建UIViewController的viewController子类并将其放入NSArray中,没有问题,但我希望我的视图具有screen.height-tabbar.height,因此我尝试通过编程创建一个。 需要任何帮
- 列表项
- SIGABRT
myView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,self.view.frame.size.height - newTabBarController.tabBar.frame.size.height)]; NSArray *controllers = [NSArray arrayWithObjects:myView, nil]; newTabBarController.viewControllers = controllers; //this is the line that a get an error :Tread1:Program receive signal: SIGABRT
希望对您有所帮助谢谢您的回答@NoTTC!我试过了,你的方法很好!因此,在你回答我的问题之前,我做了一些其他的事情。我已经创建了UIViewController的子类,并在viewDidLoad中设置了它的边界!这对我很有用!但再次感谢您的时间!
- (void) viewDidLoad{
newTabBarController = [[UITabBarController alloc]init];
newTabBarController.delegate = self;
myView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,self.view.frame.size.height - newTabBarController.tabBar.frame.size.height)];
NSArray *controllers = [NSArray arrayWithObjects:myView, nil];
newTabBarController.viewControllers = controllers; //this is the line that a get an error :Tread1:Program receive signal: SIGABRT
[myView release];
}
myView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,self.view.frame.size.height - newTabBarController.tabBar.frame.size.height)];
NSArray *controllers = [NSArray arrayWithObjects:myView, nil];
newTabBarController.viewControllers = controllers; //this is the line that a get an error :Tread1:Program receive signal: SIGABRT