Giter Site home page Giter Site logo

Comments (18)

chenxinjie1129 avatar chenxinjie1129 commented on September 25, 2024 3

设置height,设置ContentEdgeInsets,就OK拉

from rdvtabbarcontroller.

sunzhongliangde avatar sunzhongliangde commented on September 25, 2024

什么意思,这个是自定义的tabbar,提供有方法设置tabbar高度的。
/**

  • Sets the height of tab bar.
    */
  • (void)setHeight:(CGFloat)height;

from rdvtabbarcontroller.

yushan023 avatar yushan023 commented on September 25, 2024

不是 这个属性没用额 我要设配iphoneX

from rdvtabbarcontroller.

faimin avatar faimin commented on September 25, 2024

为什么不用英文提问?你认为作者看得懂中文?

from rdvtabbarcontroller.

MrDangerous avatar MrDangerous commented on September 25, 2024

RDVTabBarController *tabBarController =

[tabBarController.tabBar setHeight:@"49 或者83的动态宏定义"];

试试

from rdvtabbarcontroller.

yushan023 avatar yushan023 commented on September 25, 2024

说了setHeight没用了

from rdvtabbarcontroller.

sd1435728 avatar sd1435728 commented on September 25, 2024

我测试使用setHeight 是有效的

from rdvtabbarcontroller.

MrDangerous avatar MrDangerous commented on September 25, 2024

我也使用的RDVTabBarController,已经适配好了

from rdvtabbarcontroller.

teemo2015 avatar teemo2015 commented on September 25, 2024

设置height,设置ContentEdgeInsets,中的ContentEdgeInsets这个怎么设置的

from rdvtabbarcontroller.

teemo2015 avatar teemo2015 commented on September 25, 2024

@yushan023 适配解决了没

from rdvtabbarcontroller.

HuangWei201703 avatar HuangWei201703 commented on September 25, 2024

[self.tabbarVC.tabBar setHeight:83];

[self.tabbarVC.tabBar setContentEdgeInsets:UIEdgeInsetsMake(18, 0, 0, 0)];

from rdvtabbarcontroller.

sunzhongliangde avatar sunzhongliangde commented on September 25, 2024

@HuangWei201703 这样解决的话,badgevalue坐标不对了

from rdvtabbarcontroller.

sunzhongliangde avatar sunzhongliangde commented on September 25, 2024

@HuangWei201703 已解决好,还需要重设一下RDVTabBarItem的badgePositionAdjustment
if(iPhoneX) { item.badgePositionAdjustment = UIOffsetMake(0, 18); }

from rdvtabbarcontroller.

xxuueeyyaann avatar xxuueeyyaann commented on September 25, 2024

@sunzhongliangde 请问一下具体在哪设置啊

from rdvtabbarcontroller.

ax654123123 avatar ax654123123 commented on September 25, 2024
  • (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.

zhangqi02060227m avatar zhangqi02060227m commented on September 25, 2024

作者感觉不怎么回答问题,中文或者英文提问都不回答的、、

from rdvtabbarcontroller.

Charlschun avatar Charlschun commented on September 25, 2024

上面的伸手党也好意思说作者不回答,作者直接替你写代码算了,遇到问题自己多尝试,解决问题的能力都没有

from rdvtabbarcontroller.

TonyTong1993 avatar TonyTong1993 commented on September 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.