Reputation: 7900
I try to add UIView
on UIViewController
:
AppDelegate *md = (AppDelegate*)[[UIApplication sharedApplication] delegate];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 150, 44)];
[view setBackgroundColor:[UIColor yellowColor]];
[md.tab.view addSubview:view];
And i noticed that the UIView not start from :
I create the TabBarController on The MainWindow.Xib
Upvotes: 1
Views: 7127
Reputation: 1435
Try this:
AppDelegate *md = (AppDelegate*)[[UIApplication sharedApplication] delegate];
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, IS_I5?519:431, 150, 44)]; // Change y position
[view setBackgroundColor:[UIColor yellowColor]];
[md.tab.view addSubview:view];
Upvotes: 0
Reputation: 31304
That's correct behaviour, assuming you're adding your view to the UITabBarViewController
's view. A tab bar controller takes up the entire screen - the tabs at the bottom, and the tab content above that.
It sounds as if you want to add a view to the tab bar rather than the view controller. To do this you should use the tabBar
property of your tab bar controller.
Upvotes: 4