統(tǒng)一彈登錄頁面,有的是在push出來的頁面彈登錄頁面,有的是在present頁面彈登錄頁面
說明 :
例如:A present B
A就是presenting view controller(彈出VC)初肉;
B就是presented view controller(被彈出VC)妇智;
解決方案:
//登錄- (void)presentLoginVC{??
PhoneLoginViewController *loginVC = Storyboard(@"Main",@"PhoneLoginViewController");UINavigationController*loginNav = [[UINavigationControlleralloc] initWithRootViewController:loginVC];UIViewController*viewController = [UIApplicationsharedApplication].keyWindow.rootViewController;/* viewController.presentedViewController只有present才有值皆刺,push的時候為nil
*///防止重復彈
if([viewController.presentedViewControllerisKindOfClass:[UINavigationControllerclass]]) {
UINavigationController*navigation = (id)viewController.presentedViewController;if([navigation.topViewControllerisKindOfClass:[PhoneLoginViewController class]]) {return;? ? ? ? }? ? }
if(viewController.presentedViewController) {//要先dismiss結(jié)束后才能重新present否則會出現(xiàn)Warning: Attempt to present on whose view is not in the window hierarchy!就會present不出來登錄頁面[viewController.presentedViewControllerdismissViewControllerAnimated:falsecompletion:^{? ? ? ? ? ? [viewController presentViewController:loginNav animated:truecompletion:nil];? ? ? ? }];? ? }else{? ? ? ? [viewController presentViewController:loginNav animated:truecompletion:nil];? ? }}
2.Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead.
這個是自定義cell調(diào)用了基類的設置高度的方法译隘,在tableview沒有實現(xiàn)- (CGFloat)tableView:(UITableView)tableView heightForRowAtIndexPath:(NSIndexPath)indexPath這個代理方法好啰,然后就會出現(xiàn)這個警告赡磅。