I have a messaging app.
I have a UITabeView
in ViewController. I implement my longPressGesture event on my Custom UITableViewCell
like this to show UIMenuController
on it ( copy - forward and ... ) :
AudioMsgCell
-(void)handleLongPress:(UIGestureRecognizer *)gesture
[self becomeFirstResponder]; // i crash on this Line
UIMenuController *menu = [UIMenuController sharedMenuController];
UIMenuItem *delete = [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(Delete:)];
CGRect targetRect = [self convertRect:[self.bubbleImageView frame]
fromView:self];
[menu setMenuItems:[NSArray arrayWithObjects:delete,nil]];
[menu setTargetRect:targetRect inView:self];
[menu setMenuVisible:YES animated:YES];}
i have a XIB file
include UITextField
& some UIButton
and in myviewController i addSubView
to View.
TextingViewController
[self.view addSubview:self.inputView];
when I do long press gesture on cell I get crash on the method
AudioMsgCell
[self becomeFirstResponder]
I had this problem in past, when I implemented extrakeyboard in iOS 8 but now when do gesture on my Cell app crash with this error :
Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<UICompatibilityInputViewController: 0x14459d620> should have parent view controller:<BLTextingViewController: 0x146801000> but requested parent is:<UIInputWindowController: 0x144a05a00>'
please look at this link : Error when adding input view to textfield iOS 8
if i remove addSubView in ViewController everything is ok But i cant't see View ( include TextField & ... )
UPDATE:
if the textField is first responder (this crash not happning). bug I want to touch my cell when keyboard is resign.