84669 personnes étudient
152542 personnes étudient
20005 personnes étudient
5487 personnes étudient
7821 personnes étudient
359900 personnes étudient
3350 personnes étudient
180660 personnes étudient
48569 personnes étudient
18603 personnes étudient
40936 personnes étudient
1549 personnes étudient
1183 personnes étudient
32909 personnes étudient
认证高级PHP讲师
Il peut être modifié, et cela peut être réalisé via kvc ou une recherche récursive de sous-vues.
@interface UIView (FindView) - (UIView *)findViewWithClassName:(NSString *)aName; @end @implementation UIView (FindView) - (UIView *)findViewWithClassName:(NSString *)aName { NSLog(@"%@", self); if([[[self class] description] isEqualToString:aName]) return self; for(UIView *subview in self.subviews) { UIView *huntedSubview = [subview findViewWithClassName:aName]; if(huntedSubview != nil) return huntedSubview; } return nil; } @end
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { NSString *prefix = @"UITableViewCell"; NSString *suffix = @"EditControl"; NSString *className = [prefix stringByAppendingString:suffix]; UIView *view = [cell findViewWithClassName:className]; view.backgroundColor = [UIColor redColor]; NSLog(@"%@", view); }
Il peut être modifié, et cela peut être réalisé via kvc ou une recherche récursive de sous-vues.