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]
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
Error: 'Flutter/Flutter.H' File Not Found When Flutter Run on Ios
How to Create Dispatch Queue in Swift 3
Generate Json String from Nsdictionary in Ios
Detect Backspace in Empty Uitextfield
How to Scroll List Programmatically in Swiftui
Importing Commoncrypto in a Swift Framework
How to Intercept Touches Events on a Mkmapview or Uiwebview Objects
Class Does Not Implement Its Superclass'S Required Members
How to Count Occurrences of an Element in a Swift Array
Nsdictionary With Ordered Keys
How to Use Background Thread in Swift
How to Record Audio on Iphone With Avaudiorecorder
How to Install iOS 6 Sdk on Xcode 5
Save String to the Nsuserdefaults
How to Parse a Json File in Swift