- Notifications
You must be signed in to change notification settings - Fork139
NoCodeNoWife/LLRiseTabBar-iOS
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
仿淘宝闲鱼的TabBar (Objective-C 实现)
从我由 Android 转 iOS 开发之后,曾接过一个项目,底部的 TabBar 就是设计成中间一个按钮凸起的样子的,平时玩的 App 不多,这样的设计也就在 Instagram 上看到过,但是那时候上网找资源也没找到比较好的 (也有可能是我没找到),所以那时候就没有做得很好,到后来,突然看到了一些 App 更新之后变成了中间一个按钮凸起的样子,想起了之前想要仿着咸鱼的 TabBar,但是一直没有动手去做,所以现在就动手开始做了。
Android 版在这里
- 2015-10-19 中午:
花了一个晚上的时间,没做完,有一个问题是,在自定义的按钮上,没有显示设置好的 image,在系统的 UIButton 上就可以显示。(TMD Google 了好久没解决,原来是我自己忘了在自定义按钮的layoutSubviews方法里面调用父类的layoutSubviews方法 = =||) - 2015-10-19 下午:
中间发布按钮图片显示样式未调整好 - 2015-10-19 晚上:完成
- PNG:
- GIF:
/* -------------------- 2016-10-11 更新 -------------------- */
其实不用覆写setHighlighted: 方法,只要设置 UIButton 的adjustsImageWhenHighlighted 为NO 就可以了。
- 因为 LLTabBarItem 是继承自 UIButton 的,在设置了 ViewController 的 tabBarItem 之后,在系统的 UITabBar 中生成的实际上是 UITabBarButton(通过 Reveal 看到的),而 UITabBarButton 是继承自 UIControl 的,所以和继承 UIButton 的效果有所差别,并没有和系统的 UITabBar 效果一样。感兴趣的可以继承 UIControl 试试看。
UITabBarController *tabBarController = [[UITabBarControlleralloc]init];tabBarController.viewControllers = @[...];LLTabBar *tabBar = [[LLTabBaralloc]initWithFrame:tabBarController.tabBar.bounds];tabBar.tabBarItemAttributes = @[@{kLLTabBarItemAttributeTitle :@"首页",kLLTabBarItemAttributeNormalImageName :@"home_normal",kLLTabBarItemAttributeSelectedImageName :@"home_highlight",kLLTabBarItemAttributeType : @(LLTabBarItemNormal)}, @{kLLTabBarItemAttributeTitle :@"同城",kLLTabBarItemAttributeNormalImageName :@"mycity_normal",kLLTabBarItemAttributeSelectedImageName :@"mycity_highlight",kLLTabBarItemAttributeType : @(LLTabBarItemNormal)}, @{kLLTabBarItemAttributeTitle :@"发布",kLLTabBarItemAttributeNormalImageName :@"post_normal",kLLTabBarItemAttributeSelectedImageName :@"post_normal",kLLTabBarItemAttributeType : @(LLTabBarItemRise)}, @{kLLTabBarItemAttributeTitle :@"消息",kLLTabBarItemAttributeNormalImageName :@"message_normal",kLLTabBarItemAttributeSelectedImageName :@"message_highlight",kLLTabBarItemAttributeType : @(LLTabBarItemNormal)}, @{kLLTabBarItemAttributeTitle :@"我的",kLLTabBarItemAttributeNormalImageName :@"account_normal",kLLTabBarItemAttributeSelectedImageName :@"account_highlight",kLLTabBarItemAttributeType : @(LLTabBarItemNormal)}];tabBar.delegate = self;[tabBarController.tabBaraddSubview:tabBar];
- iOS 7.0+
- Xcode 7.0.1 (7A1001)
- iPhone6 (9.0) 模拟器
- iPhone5S (8.3) 真机
LLRiseTabBar-iOS is available under the MIT license. See the LICENSE file for more info.
About
仿淘宝闲鱼的 TabBar
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Contributors2
Uh oh!
There was an error while loading.Please reload this page.



