JFS
JFS

Reputation: 3152

NSLog memory address

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.

Upvotes: 1

Views: 643

Answers (1)

Binarian
Binarian

Reputation: 12446

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

Upvotes: 2

Related Questions