po [[self.navigationController navigationBar] subviews]
It will return something like this:
<_UINavigationBarBackground: 0x7f6ddbb0; frame = (0 -20; 320 64); opaque = NO; autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0x7f682140>> - (null),
<UINavigationButton: 0x7f686c70; frame = (5 6; 33 30); opaque = NO; layer = <CALayer: 0x7f687a10>>,
<UINavigationButton: 0x81149930; frame = (269 6; 46 30); opaque = NO; layer = <CALayer: 0x8114c110>>,
<_UINavigationBarBackIndicatorView: 0x7f6dd960; frame = (8 11.5; 13 21); alpha = 0; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x7f6771f0>> - Back
3) On each of those hex memory addresses, you can try this:
po [0x7f682140 accessibilityLabel]
in some cases, it might give you an EXC_BAD_ACCESS error, but at least one, maybe even two of those will expose an accessibilityLabel.
In my case, we have one that's, "Back" and another that is an empty space, " "
po [0x7f6dd960 accessibilityLabel]
Back
--
You received this message because you are subscribed to the Google Groups "KIF iOS Automated Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kif-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Oct 26, 2015, at 8:28 AM, mikelupo via KIF iOS Automated Testing Framework <kif-fr...@googlegroups.com> wrote:
@implementation UIView (DebugAdditions)
- (void)logRecursiveDescriptionUsingBlock:(NSString * (^)(UIView *subview))messageBlock;
{
NSAssert(messageBlock, @"A block returning the log message is required for subview logging.");
NSMutableString *logMessage = [[NSMutableString alloc] initWithString:@"\n"];
[self _appendDescriptionToLogMessage:logMessage depth:0 usingBlock:messageBlock];
NSLog(@"%@", logMessage);
}
#pragma mark - Private Methods
- (void)_appendDescriptionToLogMessage:(NSMutableString *)logMessage depth:(NSUInteger)depth usingBlock:(NSString * (^)(UIView *subview))messageBlock;
{
for (NSUInteger depthIndex = 0; depthIndex < depth; depthIndex++) {
[logMessage appendString:@" | "];
}
NSString *description = messageBlock(self);
if (!description) {
description = @"<no description>";
}
[logMessage appendFormat:@"%@\n", description];
for (UIView *subview in self.subviews) {
[subview _appendDescriptionToLogMessage:logMessage depth:(depth + 1) usingBlock:messageBlock];
}
}
@end
[view logRecursiveDescriptionUsingBlock:^(UIView *view) { return view.accessibilityIdentifier; }];