大佬教程收集整理的这篇文章主要介绍了ios – 由于未捕获的异常UIViewControllerHierarchyInconsistency终止应用程序,,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
expiredPromoTextField.inputView = DatePicker; expiredPromoTextField.delegate = self; quantityPromoTextField.inputView = quantityPicker; quantityPromoTextField.delegate = self; // Create button to close the UIPickerView UIToolbar * mypickerToolbar = [[UIToolbar alloc] initWithFrame: CGRectMake (0,320,56)]; mypickerToolbar.barStyle = UIBarStyleBlackTranslucent; [mypickerToolbar sizeToFit]; NSMutableArray * barItems = [[NSMutableArray alloc] init]; UIBarButtonItem * CancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemCancel target: self action:SELEctor (cancelDoneClicked)]; [barItems addObject: CancelBtn]; UIBarButtonItem * FLEXspace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace target: self action: nil]; [barItems addObject: FLEXspace]; UIBarButtonItem * doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target: self action:SELEctor (pickerDoneClicked :)]; [barItems addObject: doneBtn]; [mypickerToolbar setItems: barItems animated: YES]; [quantityPicker setShowsSelectionInDicator: YES]; expiredPromoTextField.inputAccessoryView = mypickerToolbar; quantityPromoTextField.inputAccessoryView = mypickerToolbar;
你知道我的意思是inputAccessoryView会崩溃的应用程序,我也问苹果的工程师,他们告诉我,这是测试版的一个问题,但现在与GM继续给同样的问题.
我该怎么办?
关键是,您不应该添加输入视图作为视图控制器视图的子视图.
(我不知道为什么iOS 7中的代码运行良好,在iOS 8中不再奏效)
之前(发生错误)
UITextField* someTF; View* customView; UIViewController *mainVc; [mainVC.view addSubview:customView]; someTF.inputView = customView;
之后(工作良好)
UITextField* someTF; View* customView; UIViewController *mainVc; // [mainVC.view addSubview:customView]; <-- delete this line someTF.inputView = customView;
以上是大佬教程为你收集整理的ios – 由于未捕获的异常UIViewControllerHierarchyInconsistency终止应用程序,全部内容,希望文章能够帮你解决ios – 由于未捕获的异常UIViewControllerHierarchyInconsistency终止应用程序,所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。