【发布时间】:2011-01-14 16:14:15
【问题描述】:
以编程方式在应用程序中创建 tabBar 相当简单:
self.tabBarController = [[UITabBarController alloc] init];
[self.view addSubview:_tabBarController.view];
UIViewController * tab1 = [[UIViewController alloc] init];
tab1.title = "A";
UIViewController * tab2 = [[UIViewController alloc] init];
tab2.title = "B";
_tabBarController.viewControllers = [NSArray arrayWithObjects:patientSearch,todoList,nil];
[tab1 release];
[tab2 release];
您还可以轻松地将图像放入选项卡中:
tab1.tabBarItem.image = [UIImage imageNamed:@"myIcon.png"];
但是如何将这些选项卡的图像设置为系统图像之一?(例如搜索、收藏夹、书签等)在 IB 中,这是通过更改“标识符”来设置的,但是如何设置你能以编程方式做到这一点
【问题讨论】:
标签: iphone objective-c cocoa-touch ipad ios