大佬教程收集整理的这篇文章主要介绍了xcode – UITabBar按钮问题,TabBar按钮变为无法点击,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
- (void)hideTabBar { UITabBar *tabBar = self.tabBarController.tabBar; UIView *parent = tabBar.superview; // UILayoutContainerView UIView *content = [parent.subviews objectATindex:0]; // UITransitionView UIView *window = parent.superview;enter code here [UIView animateWithDuration:0.5 animations:^{ CGRect tabFrame = tabBar.frame; tabFrame.origin.y = CGRectGetMaxY(window.bounds); tabBar.frame = tabFrame; // CGRect contentFrame = content.frame; // contentFrame.size.height -= tabFrame.size.height; content.frame = window.bounds; }]; if ([[[UIDevice currentDevice] systemVersion] intValue] < 7.0) { CGRect frame = tbl_AllFiles.frame; frame.size.height -=tabBar.frame.size.height; tbl_AllFiles.frame = frame; } } - (void)showTabBar { UITabBar *tabBar = self.tabBarController.tabBar; UIView *parent = tabBar.superview; // UILayoutContainerView UIView *content = [parent.subviews objectATindex:0]; // UITransitionView UIView *window = parent.superview; if ([[[UIDevice currentDevice] systemVersion] intValue] < 7.0) { CGRect frame = tbl_AllFiles.frame; frame.size.height +=tabBar.frame.size.height; tbl_AllFiles.frame = frame; } [UIView animateWithDuration:0.5 animations:^{ CGRect tabFrame = tabBar.frame; tabFrame.origin.y = CGRectGetMaxY(window.bounds) - CGRectGetHeight(tabBar.framE); tabBar.frame = tabFrame; CGRect contentFrame = content.frame; contentFrame.size.height -= tabFrame.size.height; content.frame = contentFrame; }]; } - (void)loadToolBar { toolbar = [UIToolbar new]; toolbar.barStyle = UIBarStyleBlackTranslucent; moveButton = [UIButton buttonWithType:UIButtonTypeCustom]; [moveButton setFrame:CGRectMake(10,10,120,25)]; [moveButton setBACkgroundColor:[UIColor redColor]]; [moveButton settitle:@"Move" forState:UIControlStateNormal]; [moveButton addTarget:self action:@SELEctor(moveFile_Folder:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *moveItem = [[[UIBarButtonItem alloc] initWithCustomView:moveButton] autorelease]; moveItem.style = UIBarButtonItemStyleBordered; NSArray *items = [NSArray arrayWithObjects:moveItem,nil]; toolbar.items = items; [toolbar sizeToFit]; CGFloat toolbarHeight = [toolbar frame].size.height; CGRect mainViewBounds = self.view.bounds; if ([[[UIDevice currentDevice] systemVersion] intValue] < 7.0) { [toolbar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds),CGRectGetMinY(mainViewBounds) + CGRectGetHeight(mainViewBounds) - (toolbarHeight),CGRectGetWidth(mainViewBounds),toolbarHeight)]; } else { [toolbar setFrame:CGRectMake(CGRectGetMinX(mainViewBounds),CGRectGetMinY(mainViewBounds) + CGRectGetHeight(mainViewBounds),toolbarHeight)]; } [self.view addSubview:toolbar]; [toolbar bringSubviewToFront:self.view]; }
我的问题是按钮单击hideTabBar和loadToolBar方法被调用.一切都运行正常,除了我的按钮现在在工具栏上无法点击.
请帮我.
以上是大佬教程为你收集整理的xcode – UITabBar按钮问题,TabBar按钮变为无法点击全部内容,希望文章能够帮你解决xcode – UITabBar按钮问题,TabBar按钮变为无法点击所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。