在文本框中放置文本字段

时间:2010-12-27 09:20:50

标签: iphone

是否可以在Actionsheet中放置文本字段?我试试这段代码:

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:nil 
                                                      delegate:self
                                             cancelButtonTitle:@"OK"
                                        destructiveButtonTitle:nil
                                             otherButtonTitles:nil];

    UITextField *pickerView_freq_payment = [[UITextField alloc] init];

    [menu addSubview:pickerView_freq_payment];
    [menu showInView:self.view];   
    [menu sendSubviewToBack:pickerView_freq_payment];     
    [menu setBounds:CGRectMake(0,0,320, 300)];

    CGRect pickerRect = pickerView_freq_payment.bounds;

    pickerView_freq_payment.bounds = pickerRect;

    [pickerView_freq_payment release];
    [menu release];

但它不显示任何文本字段。我找到了有关在Actionsheet中显示按钮的信息,但我需要放置文本字段而不是按钮。

我该怎么做?有人可以帮帮我吗?

2 个答案:

答案 0 :(得分:0)

我强烈建议不要这样做。 UIActionSheet在iPhone上有一个非常特殊的用途,添加文本字段可能违反Apple的人机界面指南。

你能告诉我们为什么你需要一个文本字段吗?这样,我们可以建议一个更合适的构造,比如模态视图控制器。

答案 1 :(得分:0)

不需要这样做,

您需要使用文本字段实施警报以更改密码用途,请检查此link