我尝试 NSLog 呈现 View Controller 的名称:
NSLog(@"presentingViewController is: %@", self.presentingViewController);
但我得到的只是:“presentingViewController is: UITabBarController: 0x71393d0”
我知道我需要创建一个描述,但我不知道如何以及在哪里。我没有 UITabBarController 的自定义类。
谢谢你的帮助,不要因为对专业人士来说太简单的问题而打败我。
最佳答案
如果没有自定义类,您可以使用类别覆盖 UITabBarController 中的方法。
例子:
//UITabBarController+Description.m
@implementation UITabBarController+Description (UITabBarController)
- (NSString *)description {
NSString *output = [NSString stringWithFormat:@"The tabBarController with backgroundImage: %@", self.tabBar.backgroundImage];
return output;
}
@end
关于ios - NSLog内存地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18578890/