开发者

Xcode: Custom TabBarController

开发者 https://www.devze.com 2023-03-19 14:13 出处:网络
I am creating an application that i want to have instead of the normal UITabBarController i want to make mine so it can scroll;

I am creating an application that i want to have instead of the normal UITabBarController i want to make mine so it can scroll;

So i Started by creating a simple window based application and programmatically created my UITabBar and UIScrollBar set both their frames correctly and removed the self.window.rootViewController = viewController1; portion of the code so that my app shows the scrollviewwith the tabbar and not my UIViewController

So this far everithing works as expected.

the proble开发者_如何转开发m goes when launching my viewControllers, i currently am using:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item{

    if (item.tag == 2) {
        UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
        [self presentViewController:viewController2 animated:NO completion:nil];
    }
}

the problem is that this does work but the view controller is in front of the tabbar so i can't use it to switch views again.

i have tried changing the frame of the view in the viewController so its small enough to fit the scrollview with the tab bar but it just ignores this part, so im kind of stuck here.

if anyone could point me in the right direction or tell me if im ignoring some option that i have to set will be greatly appreciated.

Thanks in advance!


Why make things difficult? just make UIButtons with custom images(images like TabBar "buttons") and put the button in a scrollview ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消