Where to determine UIView size

后端 未结 3 1580
暗喜
暗喜 2021-02-01 04:03

Summary: How should the UIViewController know the size of its UIView instance when initialising that view?

The dedicated initialisation method for an UIView

3条回答
  •  被撕碎了的回忆
    2021-02-01 04:19

    You may want to calculate the bounds of the available screen space (which depends from the presence of other views like navigation bar, tab bar, and status bar). You can use these bounds then for the frame parameter in [[UIView alloc] initWithFrame:] in loadView.

    If this is what you want, then you might find my answer over here helpful: Determine the correct size in loadView

提交回复
热议问题