I want to get the width value of my widget / today extension.
I can't use self.view.frame.size.width
because it returns the whole screen width and not the actual widget width (on the iPad the width of the extension is not equal to the screen width).
What can I do to get the actual width of the widget?
.............. Don't read self.view.frame in viewDidLoad.
frame = (0 0; 768 1024); // in viewDidLoad
You should read self.view.frame after viewDidAppear
after viewDidAppear, self.view.frame is right value for content.
frame = (0 0; 545 75.5); // in viewDidAppear
Instead of viewDidAppear
, I found that viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
is triggered automatically when the widget gets resized initially
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