文本选择菜单未出现在UIAlertView上

时间:2012-07-27 12:12:43

标签: iphone objective-c ios

我在UIAlertView中有UITextView。当我从UITextView中选择文本时,那些文本选择菜单(如复制,粘贴,选择等)隐藏在UIAlert视图后面,如下面的屏幕截图所示:

enter image description here

有没有办法让这个菜单在前面?

1 个答案:

答案 0 :(得分:0)

你必须很好地描述问题(至少你使用过的代码)

以下代码的任何方式对我都很好

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle: @"Select the Text" message:@"                    "  delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel", nil];                 

UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 65.0, 260.0, 25.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
myTextField.text = @"This is the Data string";  
[myTextField becomeFirstResponder];
[myAlertView addSubview:myTextField];

[myTextField release];
myTextField = nil;  

[myAlertView show];
[myAlertView release];
myAlertView = nil;

注意:根据您的要求对齐框架