Adding a UINavigationController as a subview of UIView

前端 未结 5 630
南方客
南方客 2020-12-06 01:39

I\'m trying to display a UILabel on top of a UINavigationController. The problem is that when I add the UILabel as a subview of UIWindow it will not automatically rotate sin

5条回答
  •  遥遥无期
    2020-12-06 02:19

    Using this code seems to work:

    nav.view.frame = CGRectMake(nav.view.frame.origin.x, nav.view.frame.origin.y - 20,
                              nav.view.frame.size.width, nav.view.frame.size.height);
    

    I did this before adding the navigation controller as a subview. Using the [UIApplication sharedApplication].statusBarFrame instead of the hard coded 20 would probably be a good idea too.

    I'm not sure if it's the best way to do it though.

提交回复
热议问题