gpt4 book ai didi

ios - NSLog内存地址

转载 作者:行者123 更新时间:2023-11-29 10:55:33 25 4
gpt4 key购买 nike

我尝试 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

Apple 的文档在这里: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html

关于ios - NSLog内存地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18578890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com