当我在 UIAlertView 上的文本框中键入内容时,背景中的 ImageButton 开始剪切。仅当文本靠近图像时才会发生。
alertview 的代码如下:
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;
}
我尝试将其设置为不透明,尝试查找 z 索引值,还尝试将图像缩小到所需的最小值。截屏没有帮助。这只发生在 iOS 7 中。