日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

心得体会???

發布時間:2025/4/16 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 心得体会??? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

自定義

@interface KKTabBar : UITabBar NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBar : UIView UITabBar 繼承自 UIView
所以可以在 UITabBar 上添加view啦。 - (instancetype)init {self = [super init];if (self) {UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menu_bottom"]];imgView.size = CGSizeMake([UIScreen mainScreen].bounds.size.width, 49);[self addSubview:imgView];UIView *view = [[UIView alloc] init];view.size = CGSizeMake([UIScreen mainScreen].bounds.size.width/4, 2);view.x = 0;view.y = 0;view.backgroundColor = [UIColor whiteColor];[self addSubview:view];self.barTopView = view;}return self; }
--------------
| UITabBarController |
-------------- @interface KKTabBarController : UITabBarController@end + (void)initialize {NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];dic[NSForegroundColorAttributeName] = [UIColor purpleColor];NSMutableDictionary *selectDic = [[NSMutableDictionary alloc] init];selectDic[NSForegroundColorAttributeName] = [UIColor redColor];UITabBarItem *item = [UITabBarItem appearance];[item setTitleTextAttributes:dic forState:UIControlStateNormal];[item setTitleTextAttributes:selectDic forState:UIControlStateSelected];}- (void)viewDidLoad {[super viewDidLoad];KKTabBar *tabBar = [[KKTabBar alloc] init];tabBar.delegate = self;[self setValue:tabBar forKey:@"tabBar"];KKHomeViewController *home = [[KKHomeViewController alloc] init];[self addVc:home title:@"主頁" image:@"icon_home" selectImage:@"icon_home" tag:1];KKCollectController *collect = [[KKCollectController alloc] init];[self addVc:collect title:@"收藏" image:@"icon_fav" selectImage:@"icon_fav" tag:2];KKSearchController *search = [[KKSearchController alloc] init];[self addVc:search title:@"搜索" image:@"icon_search" selectImage:@"icon_search" tag:3];UIStoryboard *board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];UIViewController *vc = [board instantiateViewControllerWithIdentifier:@"moreController"]; // KKMoreController *more = [[KKMoreController alloc] init];[self addVc:vc title:@"更多" image:@"icon_more" selectImage:@"icon_more" tag:4];}- (void)addVc:(UIViewController *)vc title:(NSString *)title image:(NSString *)image selectImage:(NSString *)selectImage tag:(NSUInteger)tag{vc.title = title;// 放棄系統默認渲染方式,顯示圖片原本樣式 // img = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];vc.tabBarItem.image = [UIImage imageNamed:image];vc.tabBarItem.selectedImage = [UIImage imageNamed:selectImage];vc.tabBarItem.tag = tag;KKNavController *nav = [[KKNavController alloc] initWithRootViewController:vc];[self addChildViewController:nav];}

?

----------------
| UINavigationController |
---------------- @interface KKNavController : UINavigationController@end @implementation KKNavController- (void)viewDidLoad {[super viewDidLoad];NSMutableDictionary *dic = [NSMutableDictionary dictionary];dic[NSForegroundColorAttributeName] = [UIColor whiteColor];UINavigationBar *item = [UINavigationBar appearance];[item setTitleTextAttributes:dic];[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"top"] forBarMetrics:UIBarMetricsDefault];}- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{if (self.childViewControllers.count>0) {viewController.hidesBottomBarWhenPushed = YES;UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];[btn setBackgroundImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];[btn setBackgroundImage:[UIImage imageNamed:@"back_hover"] forState:UIControlStateSelected];[btn setTitle:@"返回" forState:UIControlStateNormal];btn.titleLabel.font = [UIFont systemFontOfSize:15];[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];btn.size = CGSizeMake(50, 29);btn.backgroundColor = [UIColor lightGrayColor];// btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; // btn.contentEdgeInsets = UIEdgeInsetsMake(0, -50, 0, 0); [btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];}[super pushViewController:viewController animated:animated];}- (void)back{[self popViewControllerAnimated:YES];}

?

轉載于:https://www.cnblogs.com/kinghx/p/5236497.html

總結

以上是生活随笔為你收集整理的心得体会???的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。