I want to use A View as a Bottom ToolBar. How can I implement this idea . Anyone have any suggestion or any demo?
Asked
Active
Viewed 751 times
-2
-
2Your requirement is not very clear. Could you give us more information? – Harrison Xi Aug 27 '15 at 11:31
-
I'm not really sure what you mean either. Do you just want a view at the bottom of the screen where you can put different action-elements like buttons or what? – TMob Aug 27 '15 at 11:33
-
1That image isn't really telling anything. Whats the context, where is it placed in relation to the rest of the screen – TMob Aug 27 '15 at 11:35
-
@TMob check it out i just added full image. – Subhash Sharma Aug 27 '15 at 11:39
-
@HarrisonXi check it again added image – Subhash Sharma Aug 27 '15 at 11:39
-
1If you do decide to go with the UIView as the bottom toolbar, I would suggest getting rid of that constraint to the top and just making the constraint be to the bottom. Also add a height constraint. That will be best for different height sizes on devices. Making your own UIView as the bottom toolbar is fine, it gives you some freedom to customize it however you want. – MSU_Bulldog Aug 27 '15 at 13:10
2 Answers
0
The easiest way to achieve something like this, is to just add a UIView at the bottom of your view (e.g. in storyboard) and add the items you want to it. You'd have to resize the scrollable content of your app, so that it doesn't overlap with the bottom bar.
At last you need to hook up actions to the items that you placed inside the new UIView.

TMob
- 1,278
- 1
- 13
- 33
-
-
How do you add it? Are you working with storyboards? If so, please add a screenshot of your view in the storyboard – TMob Aug 27 '15 at 11:50
-
I'm sorry, I think you got me wrong. Please take a screenshot of your storyboard, showing the View where you want the toolbar and add the screenshot to your stackoverflow-question – TMob Aug 27 '15 at 11:53
-
This looks actually pretty good. And it doens't appear at all? What does it look like, when you run it? Is it maybe hidden? – TMob Aug 27 '15 at 12:08
0
Add this code in your singleton class -
in .h file
typedef void(^btnClick) (id sender);
@property (nonatomic,strong) btnClick pClickAction;
in .m file
- (void)addViewIn:(UIViewController*)controller With:(void(^)(id sender))btnClickBlock
{
view = [[UIView alloc] initWithFrame:CGRectMake(0, controller.view.frame.size.height-50, controller.view.frame.size.width, 50)];
btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, controller.view.frame.size.width, 50)];
btn.tag = 1233;
UIImage *Img = [UIImage imageNamed:@"add image"];
[btn setImage:Img forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
_pClickAction = btnClickBlock;
[view addSubview:btn];
//same like button you can add image nd label as your requirement
[controller.view addSubview:view];
}
if you want to add view in view controller than use this
bt if you want to add this view in all viewController than pass window in addView method
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
[self addViewIn:window With:^(id sender) {
}];

Pooja Patel
- 626
- 8
- 12