日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

心得体会???

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

自定義

@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;// 放棄系統(tǒng)默認(rèn)渲染方式,顯示圖片原本樣式 // 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];}

?

轉(zhuǎn)載于:https://www.cnblogs.com/kinghx/p/5236497.html

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。