Below is the code where I show a UIView
from under a toolbar. It is displayed by clicking a button on toolbar. Now I want to add a button to the UIView
that pops up , so as to cancel it. If possible a button over navigation bar which makes the UI better? Can anyone point me towards a tutorial or so?
-(void)likeButton:(UIBarButtonItem *)button
{
CGRect frame = CGRectMake(0, 480, 320, 190);
frame.origin.y = CGRectGetMaxY(self.optionsToolBar.frame)-frame.size.height;
bottomView.frame = frame;
[self.optionsToolBar.superview insertSubview:bottomView
belowSubview:self.optionsToolBar];
}
-(void)likeButton:(UIBarButtonItem *)button
{
CGRect frame = CGRectMake(0, 480, 320, 190);
frame.origin.y = CGRectGetMaxY(self.optionsToolBar.frame)-frame.size.height;
bottomView.frame = frame;
UIView *navigationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
[navigationView setBackgroundColor:[UIColor blueColor]];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"close" forState:UIControlStateNormal];
[button addTarget:self action:@selector(closeView:) forControlEvents:UIControlEventTouchUpInside];
[navigationView addSubView:button];
[bottomView addSubView:navigationView];
[self.optionsToolBar.superview insertSubview:bottomView
belowSubview:self.optionsToolBar];
}
- (void) closeView :(id)sender{
[[sender superView] removeFromSuperView];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.