Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to make Autoresize property work in Xcode 4.3?
- myLabel.adjustsFontSizeToFitWidth = YES;
- // UIView+viewRecursion.h
- @interface UIView (viewRecursion)
- - (NSMutableArray*) allSubViews;
- @end
- // UIView+viewRecursion.m
- @implementation UIView (viewRecursion)
- - (NSMutableArray*)allSubViews
- {
- NSMutableArray *arr=[[NSMutableArray alloc] init];
- [arr addObject:self];
- for (UIView *subview in self.subviews)
- {
- [arr addObjectsFromArray:(NSArray*)[subview allSubViews]];
- }
- return arr;
- }
- @end
- +(void)fixLabels:(UIView *)theView{
- for(UIView *v in [theView allSubViews])
- {
- if([v isKindOfClass:[UILabel class]])
- {
- if( !((UILabel*)v).adjustsFontSizeToFitWidth ){
- ((UILabel*)v).adjustsFontSizeToFitWidth=YES;
- // NSLog(@"fixed %@", theView);
- }
- }
- }
- }
- [Utility fixLabels:self.view];
- myLabel.adjustsFontSizeToFitWidth = YES;
Advertisement
Add Comment
Please, Sign In to add comment