在 iPhone 中的 UItab 栏按钮上查找单击事件时出现问题
我是 iPhone 开发新手,遇到一个问题,在 iPhone 中找不到 Tab Bar 按钮的单击事件。谁能告诉我如何找到它?
I'm new to iPhone development and I'm facing a problem where I can't find the click event of the Tab Bar button in iPhone. Can anyone tell me how to find it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用 tabbar 控制器的委托方法
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
You can also use tabbar controller's delegate method
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
首先将 Delegate 设置为您的
UIViewController
,如下所示,@interface MyRootViewController : UIViewController; {
然后在
@implementation
中确保您具有以下内容...祝您好运! :)
First set the Delegate to your
UIViewController
like this,@interface MyRootViewController : UIViewController<UITabBarDelegate> {
and then in the
@implementation
make sure you have the following...Good Luck! :)
要监听
UITabBar
项目选择,您需要将UIViewController
设置为UITabBar
的delegate
,然后实现此方法UITabBarDelegate
To listen for
UITabBar
item selection, you need to set yourUIViewController
asdelegate
of theUITabBar
then implement this method of theUITabBarDelegate