I have a UIViewController
called HomeViewController
and it has a model that contains an array of data. HomeViewController
also has a button that when pressed will show a UITableViewController
that display's the model's array of data.
My question is, what is the standard/best way to set the popover's size? I only want the popover to be tall enough to display the data, but no taller. What is common practice? I assume that I need to set contentSizeForViewInPopover
at some point but I'm not sure where...In the viewDidLoad
method of the popover class? In the prepareForSegue
method?
Here's the code I have so far: (Note that DataPresentingViewController
is my popover view controller class`)
//In HomeViewController
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.destinationViewController isKindOfClass:[DataPresentingViewController class]])
{
DataPresentingViewController *dest = (DataPresentingViewController *) segue.destinationViewController;
dest.mySavedData = self.myModel.mySavedData;
}
}
I know that I could just set the contentSizeForViewInPopover
here in the prepareForSegue
method; however, this seems like something the popover class should deal with.
You can either change the className to style, and it should work or you're going to have to add a const variable and hook it into the withStyle HOC. Then add the height and width to that const, and then call the class you made in that to the className. All these examples are on the material-ui site.
Popovers can be triggered via JavaScript — just call the popover() Bootstrap method with the id , class or any CSS selector of the required element in your JavaScript code. You can either initialize popovers individually or all in one go.
How To Create a Popover. To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.
As of iOS7 contentSizeForViewInPopover
is deprecated. You should use UIViewController
's preferredContentSize
property instead.
Hope this helps!
set contentSizeForViewInPopover
in ViewDidLoad
method in HomeViewController
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With