0

Hi I need to integrate date picker with inputView, I am on Xcode7. Using below code the application cause exception. The exception happening while I am touching UITextField element.

Here is the relevant part of the code where the date picker used.

@property (weak, nonatomic) IBOutlet UIDatePicker *graphDate;
@property (weak, nonatomic) IBOutlet UITextField *fromdate;
@property (weak, nonatomic) IBOutlet UITextField *toDate;
............................................................
..............................................................

[_graphDate setDatePickerMode:UIDatePickerModeDateAndTime];

............................................................
..............................................................

[_graphDate setHidden:TRUE];
[_graphDate setFrame:CGRectMake(600, 600, 400, 162)];
_toDate.inputView = _graphDate;
_fromdate.inputView = _graphDate;
_graphDate.date = [NSDate date];

The exception message,

 Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason:
 'child view controller:<UICompatibilityInputViewController: 0x80286850>
 should have parent view controller:<VALiveViewController: 0x7cbeda00>
 but requested parent is:<UIInputWindowController: 0x7cc25a00>'

I already refereed the answer here UIViewControllerHierarchyInconsistency in 64 bit iOS device but no idea how to apply here, I am newbie in IOS.

Any help will be appreciated.
Thanks,
Haris

Community
  • 1
  • 1
Haris
  • 13,645
  • 12
  • 90
  • 121

0 Answers0