How to configure UIAlertView? Will Apple bring this?

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

I was told that this custom view could cause my application to be rejected by Apple; It's right? If so, what is the appropriate replacement for my user control?

+6
source share
8 answers

You can add a text box to your UIAlertView

 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"title" message:@"msg" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; UITextField *txtField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)]; [alertView addSubview:txtField]; [alertView show]; [alertView release]; 
+11
source

See my blog post about this and its apple-friendly code. I added this to some of my applications, and they were all 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]; 
+4
source

If you are concerned about rejection, you can always flip your own view, which has an animation similar to UIAlertView . Check out this question here:

How to set up iOS alert viewing?

+1
source

iOS 5 now supports this natively. Check the UIAlertView alertViewStyle property.

+1
source

Quote from class link

The UIAlertView class is intended to be used as is, not subclass support. The presentation hierarchy for this class is private and should not be changed.

The last sentence seems to me that they donโ€™t want developers to change their minds.

+1
source

I think there is a better way to solve this problem. Here is a snippet of code

 UIAlertView *passwordAlert = [[UIAlertView alloc] initWithTitle:@"Enter Password" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Submit", nil]; passwordAlert.alertViewStyle = UIAlertViewStyleSecureTextInput; 

(You can find the corresponding implementations in the prodeveloper blog)

But this only works fine for iOS 5.0 and above. Please mark this. And Apple will certainly endorse this.

+1
source

I. Apple approved setting UIAlertview. From iOS 5.0, apple gives an alertview type for credential input.

Here I have listed a custom alertview that might work on an earlier version and orientation of ios custom alert

thanks,

Naven Shan

0
source

Source: https://habr.com/ru/post/886242/


All Articles