iPhone 中的自定义标签栏视图
我已按照此处操作本教程。
我在使用选项卡栏时没有遇到任何问题,但我无法弄清楚如何让按钮打开视图或 nib 文件。
请有人给一些建议吗?
我在下面添加的代码:
ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.viewControllers = [NSArray arrayWithObjects:
[self viewControllerWithTabTitle:@"Friends" image:[UIImage imageNamed:@"112-group.png"]],
[self viewControllerWithTabTitle:@"Challenges" image:[UIImage imageNamed:@"29-heart.png"]],
[self viewControllerWithTabTitle:@"Create" image:nil],
[self viewControllerWithTabTitle:@"My Photos" image:[UIImage imageNamed:@"news.png"]],
[self viewControllerWithTabTitle:@"Profile" image:[UIImage imageNamed:@"123-id-card.png"]], nil];
[self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil];
}
我希望这会有所帮助,我对此很陌生,它让我困惑了一段时间。
谢谢迈克
I have followed this tutorial here.
I have had no problems doing the tab bar but I cant work out how to get the buttons to open up a view or a nib file.
Please could someone give some advice?
The code I have added below:
ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
self.viewControllers = [NSArray arrayWithObjects:
[self viewControllerWithTabTitle:@"Friends" image:[UIImage imageNamed:@"112-group.png"]],
[self viewControllerWithTabTitle:@"Challenges" image:[UIImage imageNamed:@"29-heart.png"]],
[self viewControllerWithTabTitle:@"Create" image:nil],
[self viewControllerWithTabTitle:@"My Photos" image:[UIImage imageNamed:@"news.png"]],
[self viewControllerWithTabTitle:@"Profile" image:[UIImage imageNamed:@"123-id-card.png"]], nil];
[self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil];
}
I hope this helps, I am new to this and its had me confused for a while now.
Thanks
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
UITabBarController(作为容器视图控制器)有一个 NSArray 的 viewController。您可以在代码中或在实例化它的 NIB 文件中设置它们。
The UITabBarController (being a container view controller) has an NSArray of viewControllers. You can set these either in code or in the NIB file where you instantiate it.