如何在Actionsheet中放置textfield

有没有可能在Actionsheet中放置textfield呢?
我尝试下面的代码: 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];
复制代码但是没办法在文本框中显示。
我在action sheet中显示按钮,但是需要在按钮处放置文本框。
应该如何做呢?

哪位大神有什么想法?


、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

你不需要这么做。
参看下面的代码: - (void)alertViewUIAlertView *)alertView clickedButtonAtIndexNSInteger)buttonIndex

{

  // Clicked the Submit button

  if (buttonIndex != [alertView cancelButtonIndex])

  {

    NSLog(@"Name: %@", textfieldName.text);

    NSLog(@"Name: %@", textfieldPassword.text);

  }

}



...



- (void) someMethod

{

  UIAlertView *alert = [[UIAlertView alloc] initWithTitle"lease Login" message""

        delegate:self cancelButtonTitle"Cancel"  otherButtonTitles"Submit", nil];



  [alert addTextFieldWithValue"" label"User Name"];

  [alert addTextFieldWithValue"" label"assword"];



  // Username

  textfieldName = [alert textFieldAtIndex:0];

  textfieldName.keyboardType = UIKeyboardTypeAlphabet;

  textfieldName.keyboardAppearance = UIKeyboardAppearanceAlert;

  textfieldName.autocorrectionType = UITextAutocorrectionTypeNo;



  // Password

  textfieldPassword = [alert textFieldAtIndex:1];

  textfieldPassword.clearButtonMode = UITextFieldViewModeWhileEditing;

  textfieldPassword.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

  textfieldPassword.keyboardAppearance = UIKeyboardAppearanceAlert;

  textfieldPassword.autocorrectionType = UITextAutocorrectionTypeNo;

  textfieldPassword.secureTextEntry = YES;



  [alert show];

}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值