Skip to content

Commit

Permalink
1.1.6
Browse files Browse the repository at this point in the history
针对复用的 cell 做强化特殊处理
  • Loading branch information
yulingtianxia committed Aug 8, 2018
1 parent ab221d4 commit 4e8b365
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TBUIAutoTest.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "TBUIAutoTest"
s.version = "1.1.5"
s.version = "1.1.6"
s.summary = "Generating accessibilityIdentifier for UIAutomation."
s.description = <<-DESC
TBUIAutoTest generates UIAutomation `accessibilityIdentifier` for you.
Expand Down
17 changes: 16 additions & 1 deletion TBUIAutoTest/UIView+TBUIAutoTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,22 @@ - (NSString *)tb_accessibilityLabel
}
}
if ([self isKindOfClass:[UITableViewCell class]]) {//UITableViewCell 特殊处理
self.accessibilityIdentifier = [NSString stringWithFormat:@"(%@)",((UITableViewCell *)self).reuseIdentifier];
UIView *view = [self superview];
while (view && [view isKindOfClass:[UITableView class]] == NO) {
view = [view superview];
}
UITableView *tableView = (UITableView *)view;
NSIndexPath *indexPath = [tableView indexPathForCell:(UITableViewCell *)self];
self.accessibilityIdentifier = [NSString stringWithFormat:@"(%@-%ld.%ld)", ((UITableViewCell *)self).reuseIdentifier, (long)indexPath.section, (long)indexPath.row];
}
if ([self isKindOfClass:[UICollectionViewCell class]]) {//UICollectionViewCell 特殊处理
UIView *view = [self superview];
while (view && [view isKindOfClass:[UICollectionView class]] == NO) {
view = [view superview];
}
UICollectionView *collectionView = (UICollectionView *)view;
NSIndexPath *indexPath = [collectionView indexPathForCell:(UICollectionViewCell *)self];
self.accessibilityIdentifier = [NSString stringWithFormat:@"(%@-%ld.%ld)", ((UICollectionViewCell *)self).reuseIdentifier, (long)indexPath.section, (long)indexPath.row];
}
return [self tb_accessibilityLabel];
}
Expand Down

0 comments on commit 4e8b365

Please sign in to comment.