标签:style blog color io os 使用 ar for 文件
.h文件:
#import <UIKit/UIKit.h> @interface YLYTabBar : UIView @end
.m文件
#import "YLYTabBar.h" @implementation YLYTabBar - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // 1.设置背景色 self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithNamed:@"tabbar_background"]]; } return self; }
使用:
-(void)addTabBar { YLYTabBar *myTabBar = [[YLYTabBar alloc] init]; myTabBar.frame = self.tabBar.bounds; [self.tabBar addSubview:myTabBar]; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; //移除之前的4各UITabBarButton for (UIView *child in self.tabBar.subviews) { if ([child isKindOfClass:[UIControl class]]) { [child removeFromSuperview]; } } }
标签:style blog color io os 使用 ar for 文件
原文地址:http://www.cnblogs.com/yuanliyong520/p/3983214.html