Uialertview Addsubview in Ios7

How to add subview inside UIAlertView for iOS 7?

You can really change accessoryView to customContentView in iOS7 (and it seems that in iOS8 as well) UIAlertView

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

Try this code:

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

Remember that you need set custom accessoryView before the call [alertView show]

Sample Image

Change font size for UIAlertView in iOS7

Yes that's correct "The UIAlertView class is intended to be used as-is". You should not access any labels in UIAlertView directly as well as you should not subclass UIAlertView - this is clearly stated by Apple and is likely to lead to a rejection of your App during revision when sent for publication to the Apple Store. The same applies to UIActionSheet.

This explains why you are not given the possibility to access any UILabel via the public API of UIAlertView. Technically you can still access them looking at the content of your UIAlertView subviews NSArray property - that in fact contains all the subviews which include UILabel and UIButton instances. However as mentioned you should absolutely avoid doing this and instead look into implementing your own alert view to be loaded modally when needed.

Unable to add UITextField to UIAlertView on iOS7...works in iOS 6

You can't easily alter the view hierarchy of a UIAlertView in iOS 7. (Nor should you; the documentation specifically tells you not to.) Head over to the developer forums to see a long discussion about it.

One alternative in your case is to set alert.alertViewStyle = UIAlertViewStylePlainTextInput; This will add a text field for you. You can access it in the UIAlertView delegate callback by using UITextField *textField = [alertView textFieldAtIndex:0];.

Alert view is showing white rectangle in iOS7


now addSubview is not available in UIAlertView in iOS7

The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified

As an alternative you can use SVProgressHUD.

Add UILabel Inside UIAlertView in iOS7

AddSubview is not possible from iOS 7.

How to add subview inside UIAlertView for iOS 7?

How to add multiple UITextFields to a UIAlertView in iOS 7?

You can't do this any more, there is no addSubview for UIAlertView any more in iOS7.

Below are good alternative:

ios-custom-alertview

MZFormSheetController



Related Topics



Leave a reply



Submit