Comments (18)
设置height,设置ContentEdgeInsets,就OK拉
from rdvtabbarcontroller.
什么意思,这个是自定义的tabbar,提供有方法设置tabbar高度的。
/**
- Sets the height of tab bar.
*/
- (void)setHeight:(CGFloat)height;
from rdvtabbarcontroller.
不是 这个属性没用额 我要设配iphoneX
from rdvtabbarcontroller.
为什么不用英文提问?你认为作者看得懂中文?
from rdvtabbarcontroller.
RDVTabBarController *tabBarController =
[tabBarController.tabBar setHeight:@"49 或者83的动态宏定义"];
试试
from rdvtabbarcontroller.
说了setHeight没用了
from rdvtabbarcontroller.
我测试使用setHeight 是有效的
from rdvtabbarcontroller.
我也使用的RDVTabBarController,已经适配好了
from rdvtabbarcontroller.
设置height,设置ContentEdgeInsets,中的ContentEdgeInsets这个怎么设置的
from rdvtabbarcontroller.
@yushan023 适配解决了没
from rdvtabbarcontroller.
[self.tabbarVC.tabBar setHeight:83];
[self.tabbarVC.tabBar setContentEdgeInsets:UIEdgeInsetsMake(18, 0, 0, 0)];
from rdvtabbarcontroller.
@HuangWei201703 这样解决的话,badgevalue坐标不对了
from rdvtabbarcontroller.
@HuangWei201703 已解决好,还需要重设一下RDVTabBarItem的badgePositionAdjustment
if(iPhoneX) { item.badgePositionAdjustment = UIOffsetMake(0, 18); }
from rdvtabbarcontroller.
@sunzhongliangde 请问一下具体在哪设置啊
from rdvtabbarcontroller.
-
(void)setupViewControllers {
XSHomeViewController *firstViewController = [[XSHomeViewController alloc] init];
UINavigationController *firstNavigationController = [[UINavigationController alloc]
initWithRootViewController:firstViewController];XSPublicationViewController *secondViewController = [[XSPublicationViewController alloc] init];
UINavigationController *secondNavigationController = [[UINavigationController alloc]
initWithRootViewController:secondViewController];XSMineViewController *thirdViewController = [[XSMineViewController alloc] init];
UINavigationController *thirdNavigationController = [[UINavigationController alloc]
initWithRootViewController:thirdViewController];RDVTabBarController *tabBarController = [[RDVTabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController,
secondNavigationController,
thirdNavigationController]];
self.tabBarController = tabBarController;
if (KIsiPhoneX) {
[self.tabBarController.tabBar setHeight:83];
[self.tabBarController.tabBar setContentEdgeInsets:UIEdgeInsetsMake(18, 0, 0, 0)];
}
[self customizeTabBarForController:tabBarController];
} -
(void)customizeTabBarForController:(RDVTabBarController *)tabBarController {
NSArray *tabBarItemImages = @[@"tab-home", @"tab-fabu", @"tab-my"];
NSArray *tabBarItemTitles = @[@"首页", @"发布", @"我的"];NSInteger index = 0;
for (RDVTabBarItem *item in [[tabBarController tabBar] items]) {if(KIsiPhoneX) { item.badgePositionAdjustment = UIOffsetMake(0, 18); } UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@-Select", [tabBarItemImages objectAtIndex:index]]]; UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@-default", [tabBarItemImages objectAtIndex:index]]]; [item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage]; item.title = [NSString stringWithFormat:@"%@",[tabBarItemTitles objectAtIndex:index]]; item.unselectedTitleAttributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:10], NSForegroundColorAttributeName: UIColorFromRGB(0X8A8A8A) }; item.selectedTitleAttributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:10], NSForegroundColorAttributeName: UIColorFromRGB(0XFF6E00) }; index++;
}
}
from rdvtabbarcontroller.
作者感觉不怎么回答问题,中文或者英文提问都不回答的、、
from rdvtabbarcontroller.
上面的伸手党也好意思说作者不回答,作者直接替你写代码算了,遇到问题自己多尝试,解决问题的能力都没有
from rdvtabbarcontroller.
viewDidLayoutSubviews
if (!tabBarHeight) {
if (@available(iOS 11.0, *)) {
CGFloat safeAreaBottom = UIApplication.sharedApplication.keyWindow.safeAreaInsets.bottom;
tabBarHeight = 58.f + safeAreaBottom / 1.5f;
} else {
tabBarHeight = 58.f;
}
} else if (@available(iOS 11.0, *)) {
CGFloat safeAreaBottom = UIApplication.sharedApplication.keyWindow.safeAreaInsets.bottom;
tabBarHeight = 58.f + safeAreaBottom / 1.5f;
}
这里会重新设置tab的高度,所以tabBar setHeight:没啥用,继承tabController重写viewDidLayoutSubviews
from rdvtabbarcontroller.
Related Issues (20)
- UI Changes for TabBarController in iPhoneXR HOT 2
- Push to the next page hide the tabBar and pop back, and show the tabBar and the tableView content will move down
- Push it to the next page and hide the tabBar and pop it back and show the tabBar, and the tableView content moves down HOT 1
- iOS 10以下 无法隐藏tabar HOT 1
- After tabbar is hidden, the bottom rectangle of the page is blank
- About roundf() in RDVTabBarItem HOT 3
- 侧滑
- BadageValue不对
- Changes for iPhoneX HOT 6
- bugs HOT 1
- The contentView of RDVTabBarController height is error
- how to dynamic change selectedItem image or title ?
- [RDVTabBarController shouldAutorotate] HOT 1
- how can i change the item selectedimage and image tintColor? in your code, i can't change it like Apple's.
- how can i change the tabbarItem's icon tintColor?
- Why tabbarHeight 58.f? HOT 2
- 使用后怎么获取当前的VC
- [viewController.view removeFromSuperview] 这样移除不正确
- Swift 4.2 and Xcode 10 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdvtabbarcontroller.