How to determine the size of a view controller extension view controller that is not a subclass of SLComposeServiceViewController?

I am trying to make extension extensions for sharing URLs from Safari. The Xcode project template provides a ViewController, which is a subclass of SLComposeServiceViewController . My problem is that my extension is not going to fit into the "standard" exchange template - I need to provide a user interface for it. Therefore, I replaced the parent class with a regular UIViewController. My extension continues to load normally in Safari - but . I cannot figure out how to change a user interface similar to SLComposeServiceViewController .

My ViewController starts with the full width x of the device height and even after calling [self setPreferredContentSize:CGSizeMake(320.0f, 320.0f)]; which is recommended if AutoLayout is not used, as a test to see if the size is reduced, nothing happens.

I tried this both in the simulator and on my iPad with iOS 8 beta 5.

+5
source share
1 answer

I managed to resize my dialog by doing ...

 let frame = self.view.frame let newSize:CGSize = CGSize(width:frame.size.width, height:frame.size.height * 2) self.preferredContentSize = newSize 

This is animated and that’s it.

0
source

Source: https://habr.com/ru/post/1201019/


All Articles