IPhone / iPod button in background shifts to UIAlertView TextBox

As you type into the text box in UIAlertView, ImageButton in the background starts to work. This only happens when the text approaches the image.

The problem

The code for alertview is as follows:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"... number"
                                                message:nil
                                               delegate:self
                                      cancelButtonTitle:@"Cancel"
                                      otherButtonTitles:@"Ok", nil];

[alert setAlertViewStyle:UIAlertViewStylePlainTextInput];
[[alert textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeNumberPad];
[[alert textFieldAtIndex:0] becomeFirstResponder];
[alert setTag:1];
[alert setOpaque:true];
[alert show];

//EDIT
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (alertView.tag == 2)
    {
        NSString* title = [alertView buttonTitleAtIndex:buttonIndex];
        if ([title isEqualToString:@"Cancel"])
        {
            [self doSomething1];
        }

        if([alertView.title isEqualToString:@"Are you sure?"] && [title isEqualToString:@"YES"])
        {
            [self doSomething2];
        }
    }
}

- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
    if (alertView.tag == 1){
        NSString *inputText = [[alertView textFieldAtIndex:0] text];
        if( [inputText length] == 10 )
        {
            NSUserDefaults* def = [NSUserDefaults standardUserDefaults];

            [def setObject:inputText
                    forKey:@"FIELD"];
            [def synchronize];
            return YES;
        }
        else
        {
            return NO;
        }
    }
    return YES;
}

I tried to set it to opaque, I tried to find the z-index values, and I also tried to scale the image to the smallest that should be. Taking pictures does not help. This only happens in iOS 7.

+4
source share
1 answer

UIAlertView UIWindow, . UIWindow Level UIWindowLevelAlert. ( ) . , UIAlertView , . UIView.

if (alertView.tag == 1), if (alertView.tag == 2), - UIAlertView 1. ? , , ? , , .

-alertViewShouldEnableFirstOtherButton: -drawRect: UIAlertView. , . NSUserDefaults -synchronize, . - -alertViewShouldEnableFirstOtherButton:, . , UITextFieldDelegate -textField:shouldChangeCharactersInRange:replacementString:. NSUserDefaults -synchronize .

PSPDFAlertView.

+1

All Articles