Reputation: 1227
I want to have this bottom bar on every UIViewController, I took this as tab bar first, but then I changed it to UIView because I need to scroll the bar as it contains more buttons, but now the issue is how to show this bar on every UIViewController and where I should declare this. Can anyone guide me for that.
Thanks in advance.
This way I set UIView as bottom bar in one of UIViewController.
viewBotBar = [[UIView alloc]initWithFrame:CGRectMake(0, 380, 320, 79)];
viewBotBar.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"1aa.png"]];
[self.view addSubview:viewBotBar];
Upvotes: 1
Views: 112
Reputation: 20551
just add this view in window for every view like bellow..
write this method in AppDelegate.m
file and call this method after add rootViewController..
-(void)addCustomBottomBar{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
viewBotBar = [[UIView alloc]initWithFrame:CGRectMake(0, 380, 320, 79)];
viewBotBar.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"1aa.png"]];
[self.window addSubview:viewBotBar];
[self.window bringSubviewToFront:viewBotBar];
[UIView commitAnimations];
}
UPDATE:
see these links for Custom TabBar..
Upvotes: 1
Reputation: 49730
hi my dear Friend i just google it and i found Best tutorial for you please download bellow link's example:-
https://github.com/a1phanumeric/PeekabooTabBarController
hear is the demo Image:-
Hope its helps you al the very best :)
Upvotes: 3
Reputation: 3299
You can create one class file. Then implement one method for custom Tab & try to call this method on every View controller. Then add this bar with object of that class.
Upvotes: 0
Reputation: 6427
Firstly Access the window object like
UIWindow *window = [UIApplication sharedApplication].keyWindow;
viewBotBar = [[UIView alloc]initWithFrame:CGRectMake(0, 380, 320, 79)];
viewBotBar.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"1aa.png"]];
window addSubView:viewBotBar];
Upvotes: 0