简体   繁体   中英

Is it possible to modify uitabbarcontroller height?

我听说,如果您从底部移动选项卡栏,那么您的应用将被拒绝,因为这违反了他们的政策,但是我想修改高度并添加admob横幅视图和一些按钮,如果这样做,将被拒绝?

You can change the tabBar height like this:

CGRect viewFrame=self.tabBar.frame;
        //Sample parameters, add what fits your needs
        viewFrame.origin.y -=30;
   viewFrame.origin.x -=10;
   viewFrame.size.height=150;
   viewFrame.size.width=200;
        self.tabBar.frame=viewFrame;

This is for UITabBar not tabBarController in case you created a tab-based project.

Your app might not be rejected. Just because you change the control object of tab doesn't mean any security issues. For example, apple's own app store app on iPad is a tab bar controller, but the control object is uisegmentcontrol object.

You can hide or change the tab bar in a tab bar controller very easily. The following code should explain it easily.

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.tabBar.hidden = YES;

    for(UIView *view in self.view.subviews) {
        if([view isKindOfClass:[UITabBar class]]) {
            [view setFrame:CGRectMake(view.frame.origin.x, self.view.frame.size.height+49, view.frame.size.width, view.frame.size.height)];
        }
        else {
            [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, self.view.frame.size.height)];
        }

    }
}

Also I suggest you give more thought to this method. Container Controllers .

However, if apple rejects you can change things very easily. Don't worry a lot to try something new. Maybe apple will get your idea and pay you some royalty to use even :P.

AFAIK, it's not possible to modify the height. You have to customize the tabbarcontroller to achieve this.

Try the sample project for this in Github.

And what about contentViewController? Because if you change heigth (and move position.y), you should increase viewcontroller size too, isn't it?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM