在我的应用程序中,我有一个部分隐藏的工具栏,当点击视图的暴露部分时,它的框架被转换为视图。翻译作品和工具栏上的按钮功能。但是,在工具栏被转换到隐藏位置后,被暴露的工具栏覆盖的区域是不可点击的。
以下是代码的相关部分:
在viewDidLoad
显示工具栏的视图控制器中:
self.filterViewController = [[LKCEventListFilterViewController alloc] initWithNibName:[LKCEventListFilterViewController nibName] bundle:nil];
self.filterViewController.delegate = self;
self.filterViewController.view.frame = CGRectMake(self.filterViewController.view.frame.origin.x, self.filterViewController.view.frame.origin.y - 60, self.filterViewController.view.frame.size.width, self.filterViewController.view.frame.size.height);
[self.view addSubview:self.filterViewController.view];
显示工具栏的代码,LKCEventListFilterViewController
类的一部分
- (IBAction)openTabButtonPressed:(id)sender
{
NSInteger translation = 60;
if(!self.isFilterViewOpen)
{
self.isFilterViewOpen = YES;
}
else
{
self.isFilterViewOpen = NO;
translation = -translation;
}
[UIView animateWithDuration:0.2 delay:0 options: UIViewAnimationCurveEaseOut animations:^{
CGRect frame = self.view.frame;
frame.origin.y += translation;
self.view.frame = frame;
}
completion:^(BOOL finished){ }];
}