문제

I try to NSLog the name of the presenting view controller:

NSLog(@"presentingViewController is: %@", self.presentingViewController);

but all I get is: "presentingViewController is: UITabBarController: 0x71393d0"

I know I need to create an description but I don't know how and where. I don't have a custom class for the UITabBarController.

Thanks for you help and don't beat me up for question which might be too easy for pros.

도움이 되었습니까?

해결책

Without custom class you could overwrite the method in the UITabBarController with a category.

Example:

//UITabBarController+Description.m
@implementation UITabBarController+Description (UITabBarController)

- (NSString *)description {
    NSString *output = [NSString stringWithFormat:@"The tabBarController with backgroundImage: %@",     self.tabBar.backgroundImage];
    return output; 
}
@end

Documentation from Apple here: https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top