当我在ios8崩溃中运行时,我在选择器上方创建了一个带有两个按钮的工具栏并在ios7上工作:
终止应用程序2到未捕获的异常'UIViewControllerHierarchyInconsistency',原因:'子视图控制器:应该有父视图控制器:但是请求的父级是:'
这是在ios7中安静工作的代码段:
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, 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 = …
Run Code Online (Sandbox Code Playgroud)