Domanda

Let Say there was a working iPad app. It has a TextField and a small button (arrow) at the end of the TextField. When ever the the small arrow is click, it should display the suggested options.(as UiPopOver)

The new requirement was , not only when the arrow button is clicked, even when the Textfield is touched, the popover should be shown over.

Method to show() in arrow button touchUpside event:

UIPopoverController activityPopover = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
[activityPopover presentPopoverFromBarButtonItem:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

Method to hide():

 [activityPopover dismissPopoverAnimated:YES];

What I did was very simple. Added gestureevent to the text field and any single tap over it will trigger the arrow button click.

[button sendActionsForControlEvents:UIControlEventTouchUpInside];

but after adding the above piece of code, my app started crashing randomly.. I could not trace the pattern. I tried setting break point, but could not find anything. It just shows the interrupt SIGABRT and crashes. no log is written.

commenting the above code, it works fine.

I have no clue how to trace the issue.

Any help please?

È stato utile?

Soluzione

I got similar situation in my case, because the button event got triggered two times, when touched over the button. Probably, both SingleTap gesture and the button tap event are triggered at same time, and try to disable UserIneraction over the button, and call the method associated directly, instead of triggering button event! I am not sure about this is the root cause. Am not a pro too!

Good Luck!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top