Remote debugging can be really difficult, especially for released applications. You can't send ad hoc releases to everyone! Would love that, with service like TestFlight, but normal Apple iOS developer account can register only max 100 devices.
So what can you do?
Showing posts with label UIAlertView. Show all posts
Showing posts with label UIAlertView. Show all posts
Wednesday, September 7, 2011
Tuesday, July 6, 2010
UITextField textFieldShouldBeginEditing called twice in iOS4
When you tap UITextField, you get two textFieldShouldBeginEditing calls. This looks like a bug in initial iOS4 release. Workaround is to use a BOOL flag to decide what you should do with that call:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if (self.allowEdit)
{
[self askUser];
return NO;
}
return YES;
}
- (void)askUser
{
if (self.alertVisible)
return;
self.alertVisible = YES;
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:@"Please verify"
message:@"Do you want to edit?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Yes",
nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex
{
self.alertVisible = NO;
if (buttonIndex == 1)
[self doSomething];
}
The bug will (should) be fixed in some future iOS4 release, so it's more safe to isolate your work-around inside your own routines as much as possible to minimize possible unwanted side-effects.
Labels:
BOOL,
iOS4,
iphone,
UIAlertView,
UITextField
Subscribe to:
Posts (Atom)