UIView background sizing issue

后端 未结 7 745
梦如初夏
梦如初夏 2021-01-28 07:06

I\'m adding a UIImageView to the UIViewController\'s UIView as I would normally, with the frame of the image view being the same as self.view to make sure that the

7条回答
  •  执念已碎
    2021-01-28 07:21

    I had the same problem and it solved with this:

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    

    self.view.frame give you the wrong x and y when status bar is not hidden

提交回复
热议问题