How to create UIView in storyboard for UIBarButtonItem presenting popovercontroller. Is it possible to create separate UIView without having any UIViewController?
Requirement is that UIBarButtonitem in UIViewController when pressed should present a UIView as a popover controller, which has a UITableview in it.
Thanks for help.
If you want to present a table view, you will be better off having a table view controller, regardless how you are showing the table (popover or otherwise).
Simply setup a new view controller in storyboard, add a segue from the bar button and specify the "Style" to be Popover.
Storyboards make this trivial, but you will need to create a new view controller for it to work. Drag a UITableViewController
into your storyboard and change its size to be "Freeform".
Then click on the view inside of the new table view controller and change its size to something appropriate for a popover.
Now you can drag a connection from your UIBarButtonItem
to the new view controller and set its Action Segue to be "popover"
You can now implement the table view functionality in a UITableViewController
subclass for your new view controller and you can use -prepareForSegue:
on your calling view controller to pass in any properties before the popover gets displayed.
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.