0

I am adding a tableview inside an alertviewcontroller , I have given delegate and datasource to the table. All delegate and datasource methods except cellForRowAtIndexPath are called. I have return a static value for number of rows in section to prevent 0 rows. Still it is occurring.

Abhishek Master
  • 192
  • 2
  • 19

2 Answers2

4

You are not supposed to modify the view hierarchy of a UIAlertController. You’ll either need to create your own view controller that mimics an alert controller or find a framework that does that for you.

To quote the Apple docs:

The view hierarchy for this class is private and must not be modified.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

I would suggest you to create a custom UIViewController, add required functionality and present it as a Form Sheet. Refer https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/PresentingaViewController.html

sarawanak
  • 387
  • 1
  • 6
  • 17