I am creating a view controller programmatically which is a UITabBarDelegate
and contains a UITabBar
.
UITabBar *tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 200, 320, 49)];
[self.view addSubview:tabBar];
I don't really want to hardcode the frame values in case the screen resolution changes or I use the view in a different context with a different height, for example.
I'm vaguely aware I can create the tab bar without these values and probe the window and tabbar for height and width to calculate the desired values but I'm struggling to achieve this. What I want to achieve is a tab bar of the standard width and height correctly positioned at the bottom of the enclosing view.