开发者

Xcode: Custom TabBarController

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜