Wrong frame value while accessing the view from storyboard in IOS

后端 未结 2 1737
北海茫月
北海茫月 2021-02-08 00:58

I am accessing the size of the frame of view from storyboard. Below is my code for accessing frame property from storyboard.

SmallView *smallView = [self.storybo         


        
相关标签:
2条回答
  • 2021-02-08 01:07

    Gettings a frame of a viewController's view which might not even displayed is not a good practice. The point where you can assume, everything is in place is the viewControllers's ViewDidLoad method.

    0 讨论(0)
  • 2021-02-08 01:17

    Uncheck the "Resize View From Nib" box in the inspector. That should give you the correct size for a freeform view controller.

    0 讨论(0)
提交回复
热议问题