简体   繁体   中英

“cellForRowAtIndexPath” for a tableview inside alertviewcontroller not called

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM