-3
UITextField
이 iOS8에서 작동하지 않습니다. 텍스트 상자를 클릭 할 때 키보드가 보이지 않고 충돌이 표시되지 않습니다. 하지만 그것은 iOS7 장치에서 잘 작동합니다. 다음 코드를 사용하고 있습니다 :IOS8에서 UITextField가 작동하지 않습니다.
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"TF_MSG_ ENTER", @"") message:@"\n\n" delegate:self cancelButtonTitle:NSLocalizedString(@"TF_CANCEL_TEXT", @"") otherButtonTitles:NSLocalizedString(@"TF_MSG_ OK", @""), nil];
UITextField *txBookmarkName = nil;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)
{
txBookmarkName = [[UITextField alloc] initWithFrame:CGRectMake(12.0f, 45.0f, 260.0f, 25.0f)];
myAlert.alertViewStyle = UIAlertViewStylePlainTextInput;
txBookmarkName = [myAlert textFieldAtIndex:0];
}
else
{
txBookmarkName = [[UITextField alloc] initWithFrame:CGRectMake(12.0f, 45.0f, 260.0f, 25.0f)];
IF_PRE_IOS4 (
[txBookmarkName release], txBookmarkName = nil;
txBookmarkName = [[UITextField alloc] initWithFrame:CGRectMake(12.0f, 65.0f, 260.0f, 25.0f)];
);
}
[txBookmarkName setDelegate:self];
[txBookmarkName setText:nameLabel.text];
myAlert.tag=TF_TAG_TEXT_FIELD_RENAME;
[txBookmarkName setBorderStyle:UITextBorderStyleRoundedRect];
[txBookmarkName becomeFirstResponder];
[txBookmarkName setAutocorrectionType:UITextAutocorrectionTypeNo];
txBookmarkName.tag=TF_TAG_TEXTFIELD;
[myAlert addSubview: txBookmarkName];
[myAlert setFrame:CGRectMake(0, 0, 300,50)];
IF_PRE_IOS4 (
CGAffineTransform t = CGAffineTransformMakeTranslation(0.0f, 85.0f);
[myAlert setTransform: t];
);
[myAlert show];
[txBookmarkName release];
if ([[UIDevice currentDevice].systemVersion floatValue] < 7.0)
[myAlert release];
도와주세요.
미리 감사드립니다.
시뮬레이터를 사용하여 테스트 중이십니까? –
시뮬레이터와 장치에서 작동하지 않습니다. –
은 UITextField의 userInteractionEnabled 및 enabled 속성이 YES로 설정되어 있습니까? –