Ios NSLog内存地址

Ios NSLog内存地址,ios,objective-c,nslog,Ios,Objective C,Nslog,我尝试记录显示视图控制器的名称: NSLog(@"presentingViewController is: %@", self.presentingViewController); 但我得到的只是:“presentingViewController是:UITabBarController:0x71393d0” 我知道我需要创建一个描述,但我不知道如何以及在哪里创建。我没有UITabBarController的自定义类 感谢您的帮助,不要因为专业人士太容易提出的问题而责骂我。如果没有自定义类,您

我尝试记录显示视图控制器的名称:

NSLog(@"presentingViewController is: %@", self.presentingViewController);
但我得到的只是:“presentingViewController是: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
苹果公司提供的文件如下:

正如Viktor所指出的,只要在UITabBarController上创建一个类别,并重写方法:-(NSString*)描述,如果可能的话,最好在子类中完成。如果苹果自己在一个类别中实现了
-description
(这是合法的,可以自由地从一个SDK切换到另一个SDK,并且不容易被开发人员发现),那么上述行为是未定义的行为。类别用于添加方法,而不是重写方法。