2

状态栏与视图重叠如何在iOS7中设置状态栏下方的视图我使用的是XIB而不是故事板

4

4 回答 4

2

我使用以下代码来解决问题。

- (void) viewDidLayoutSubviews {
    CGRect viewBounds = self.view.bounds;
    CGFloat topBarOffset = self.topLayoutGuide.length;
    viewBounds.origin.y = topBarOffset * -1;
    self.view.bounds = viewBounds;
}
于 2013-10-22T06:11:14.953 回答
1

尝试这个

 if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;   // iOS 7 specific

-(void)viewDidLoad您需要在您的方法中添加上述内容。

于 2013-09-23T12:52:37.457 回答
1

在 iOS 7.0 中,UI 状态栏是透明的,为了适应应用程序中的更改,您可以使用状态栏样式:

 UIStatusBarStyleDefault

状态栏变暗,而内容较浅

 UIStatusBarStyleLightContent

如果在应用程序中查看的背景图像遇到问题,其中图像在状态栏后面扩展。使用 Image 上的尺寸以 nib 或编程方式(以适合您的方式)显式设置图像。

有关 UI 更改的更多参考,请参阅 Apple 的本指南。https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/TransitionGuide.pdf

于 2013-09-23T12:45:17.770 回答
0

尝试这个:

如果你想从 plist 中禁用状态栏,试试这个:

   Status bar is initially hidden : YES
   View controller-based status bar appearance : NO

这对于 iOS 7 是必需的,对我有用。在 info.plist 中设置这两个标签。

每次您的视图控制器出现时,在 viewDidLoad 或图像选择器控制器完成时,请使用以下命令:

 - (void) imagePickerController:(UIImagePickerController *)picker1 didFinishPickingImage:       (UIImage *)image editingInfo:(NSDictionary *)editingInfo
  {
      [[UIApplication sharedApplication] setStatusBarHidden:YES];

   .
   .
   .
   .
  }
于 2013-09-20T10:09:47.820 回答