UIPresentationController - presentation view size?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

UIPresentationController - presentation view size?

Max Farrar

I'm using a UIPresentationController, but I can't sort out how to get it showing the way I want it to.

I'm editing the frameOfPresentedViewInContainerView() function, and I need to be returning the frame (a CGRect) to display my content in.

The tutorial I followed uses CGRectInsert(self.containerView.bounds, 50, 50), which makes the window centered with the borders brought in 50px. If I return self.containerView.boundsjust as itself, the view takes up the whole screen.

I'd like the overlaying view to be the width of the parent view (so, self.containerView.bounds.width), but I want the height to be the size needed to show the content of the new view without cutting anything off.

I tried a CGRect at (0,0) with width and height from self.preferredContentSize, but it's not returning sizes that work.. What can I do?

I tried frame = CGRect(x:0, y: self.containerView.bounds.height/2, width: self.containerView.bounds.width, height: self.containerView.bounds.height/2) just as a test (but that's just making the view half the size of the parent view), but when I rotate the screen, suddenly the new view is almost off screen..

--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/335d7553-bcd6-4f96-b810-49033292b5c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.