2

How we can add the UIView on UIAlertController as we can do on the UIAlertView by using @"AccessoryView" but now it is deprecated in iOS 8 . So I want to use it with UIAlertController but how?

3
  • Search google, then use a custom control. Commented Jan 22, 2015 at 11:13
  • What is custom control? I didn't get it anywhere Commented Jan 22, 2015 at 11:22
  • Something specially created, like everything at www.cocoacontrols.com Commented Jan 22, 2015 at 11:23

3 Answers 3

5

Try below thing,

var alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.ActionSheet);
alert.view.addSubview([YOUR CUSTOMR VIEW]);

Hope its helps..

Sign up to request clarification or add additional context in comments.

Comments

0

You can subclass UIViewController and make CustomAlertViewController and use presentViewController to display it.

For reference you can see this link. It works for iOS 8 only.

1 Comment

Modified my answer accordingly.
0

You can add a UITableView on UITableViewCell , also CollectionView on the UITableviewCell. you have to specify datasources inside the cell classes according to the cell index.

register the child cell nib inside the - (void)awakeFromNib function

[self.collectionView registerNib:[UINib nibWithNibName:@“childCollectnCell” bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@“childCollectnCell”]

and Specify the datasources and delegates inside class

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.