How to customize UIAlertView? Will Apple approve it?

后端 未结 8 2013
逝去的感伤
逝去的感伤 2021-02-04 18:48

I am using a custom UIAlertView with UITextField to get password from the user.

I have been told that this custom view may cause my App to get

8条回答
  •  攒了一身酷
    2021-02-04 19:22

    See my blog post of doing this and its perfectly accepted code by apple. I added this in some of my apps and they all got accepted. So use it without fear!!

    Here is the code you can use :

    UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here!" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
    UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
    [myTextField setBackgroundColor:[UIColor whiteColor]];
    [myAlertView addSubview:myTextField];
    CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
    [myAlertView setTransform:myTransform];
    [myAlertView show];
    [myAlertView release];
    

提交回复
热议问题