iOS multiple text fields on a UIAlertview In IOS 7

前端 未结 3 1016
名媛妹妹
名媛妹妹 2020-12-10 06:22

So the new iOS 7 has come out and I\'m trying to add multiple textFields and labels to the UIAlertviews. I need three. I\'ve been trying to add them as subviews and that doe

3条回答
  •  清歌不尽
    2020-12-10 07:19

    You can change accessoryView to any own customContentView in a standard alert view in iOS7

    [alertView setValue:customContentView forKey:@"accessoryView"];
    

    Note that you must call this before [alertView show].

    Simplest illustrating example:

    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"TEST" message:@"subview" delegate:nil cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
    UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
    v.backgroundColor = [UIColor yellowColor];
    [av setValue:v forKey:@"accessoryView"];
    [av show];
    

    enter image description here

提交回复
热议问题