- (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方法被调用.一切都运行正常,除了我的按钮现在在工具栏上无法点击.@H_404_14@请帮我.
解决方法 如果你的vIEwcontroller不是根视图控制器iOS没有获取视图框,我有一个类似的问题.在vIEwdIDload中将此行添加到vIEwcontroller,
self.vIEw.frame = [UIScreen mainScreen].bounds;
希望能帮助到你
总结以上是内存溢出为你收集整理的xcode – UITabBar按钮问题,TabBar按钮变为无法点击全部内容,希望文章能够帮你解决xcode – UITabBar按钮问题,TabBar按钮变为无法点击所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)