- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想我已经完成了这里的功课。
我希望我的应用委托(delegate)成为我的 UITabBarController
的委托(delegate).
使用 IB,我连接了 UITabBarController
的委托(delegate)给我的应用委托(delegate)。
App Delegate 头文件是:
@interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
我要实现的委托(delegate)方法是:
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
NSLog(@"shouldSelectViewController called.");
// do some stuff with viewController
return YES;
}
我的应用委托(delegate)有一个导出到 UITabBarController
这是在 IB 中连接的。当我这样做时:
NSLog(@"tab bar controller delegate is %@", self.tabBarController.delegate);
我得到了一个很好的结果,例如 tab bar controller delegate is <MyAppDelegate: 0x6e86a30>
.
我错过了什么?
最佳答案
就写这段代码吧。通常在 viewDidLoad()
中。
self.tabBarController.delegate = self;
如果当前 Controller 是一个 UITabBarController
那么:
self.delegate = self
关于iphone - 选项卡栏 Controller :shouldSelectViewController: not being called when delegate is set,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9493663/
我正在尝试调用我的 shouldSelectViewController 委托(delegate)函数。但它似乎不起作用。 我做了以下操作,但函数仍然没有被调用 .h @interface myApp
我正在使用与 swift 一起打包的选项卡栏 Controller 模板。我已将 FirstViewController 和 SecondViewController 嵌入到导航 Controller
我有一个看似正常的用例:在选择某个选项卡(在我的例子中为“注销”)时,我想显示一个警告,要求在转换之前进行确认。这似乎应该在 shouldSelectViewController 函数中处理。但是,a
我已阅读 Apple 文档 - http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS
我需要控制此方法,以便我可以在我的应用程序中进行更改。但是我无法使这个实现工作,有人可以帮忙吗? 这是我的 TabbedPage 的自定义渲染器: public class MainTabbedPag
我正在使用 Storyboard并将 UITabBarViewController 作为我的导航 Controller 。我需要的是使用 shouldSelectViewController 方法,它
我想我已经完成了这里的功课。 我希望我的应用委托(delegate)成为我的 UITabBarController 的委托(delegate). 使用 IB,我连接了 UITabBarControll
我在 UITabBarController 中有 3 个 TabBarItems: 我在 AppDelegate 中有方法: - (BOOL)tabBarController:(UITabBar
我正在尝试为我的 UITabBarController 中的选项卡之间的转换设置动画,当我按下选项卡按钮时它工作正常。但是,当我通过调用以编程方式切换选项卡时 [self.tabBarControll
我是一名优秀的程序员,十分优秀!