0

これは私にとってはうまくいくでしょう

横向きモードにすると、なぜこれが伸びるのか

この問題を解決するにはどうすればよいですか。このテキスト フィールドをプログラムで追加しています。以下のコードを参照してください

AppDelegate * delegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];



    delegate.alert=[[UIAlertView alloc]initWithTitle:@"Password" message:@"\n\n\n\n\n" delegate:self cancelButtonTitle:nil otherButtonTitles:nil, nil];


    delegate.lbl=[[UILabel alloc]init];
    delegate.lbl.frame=CGRectMake(60, 42, 200, 18);

    delegate.lbl.backgroundColor=[UIColor clearColor];
    [delegate.alert addSubview:delegate.lbl];

    delegate.lbl.text=@"Please enter the pwd";
    delegate.lbl.textColor=[UIColor grayColor];


    CGRect rect = {70, 70, 140, 30};
    delegate.txtfield1 = [[UITextField alloc] initWithFrame:rect];
    delegate.txtfield1.backgroundColor = [UIColor whiteColor];
    delegate.txtfield1.placeholder=@" Password";

    delegate.txtfield1.borderStyle = UITextBorderStyleRoundedRect;


    delegate.txtfield1.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;

    delegate.txtfield1.delegate=self;
    delegate.txtfield1.secureTextEntry=YES;

    [delegate.alert addSubview:delegate.txtfield1];

    /*delegate.txtfield1.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;*/

    CGRect rect1 = {70, 110, 140, 30};
    delegate.txtfield2=[[UITextField alloc]initWithFrame:rect1];
    delegate.txtfield2.backgroundColor = [UIColor whiteColor];

    delegate.txtfield2.placeholder=@" Confirm pwd";
    delegate.txtfield2.delegate=self;
    delegate.txtfield2.secureTextEntry=YES;


    delegate.txtfield2.borderStyle=UITextBorderStyleRoundedRect;

    delegate.txtfield2.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;

    [[delegate.txtfield2 layer]setBorderColor:[[UIColor blackColor]CGColor]];
    [[delegate.txtfield2 layer]setBorderWidth:1.5];
    [[delegate.txtfield2 layer]setCornerRadius:3];

    [delegate.alert addSubview:delegate.txtfield2];


    delegate.SaveButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    delegate.SaveButton.frame = CGRectMake(12, 150, 110, 40);
    [delegate.SaveButton setTitle:@"Save" forState:UIControlStateNormal];


    [delegate.SaveButton addTarget:self action:@selector(Save) forControlEvents:UIControlEventTouchUpInside];

    [delegate.alert addSubview:delegate.SaveButton];


    delegate.CancelButton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
    delegate.CancelButton.frame=CGRectMake(160, 150, 110, 40);

    [delegate.CancelButton setTitle:@"Cancel" forState:UIControlStateNormal];


    [delegate.CancelButton addTarget:self action:@selector(Cancel) forControlEvents:UIControlEventTouchUpInside];

    [delegate.alert addSubview:delegate.CancelButton];

    [delegate.alert show];
4

1 に答える 1

0

これをコード「\n\n\n\n\n」から削除するだけUITextViewです。
編集

これには、独自のカスタム アラートを作成する必要があります。

于 2013-06-27T07:00:38.583 に答える