你好我正在开发一个在应用程序中播放视频的应用程序 我使用了以下代码 -
MPMoviePlayerViewController *theMovie=
[[MPMoviePlayerViewController alloc] initWithContentURL: myurl];
theMovie.moviePlayer.repeatMode=MPMovieRepeatModeOne;
theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[theMovie.moviePlayer play];
[self.view addSubview:theMovie.view];
答案 0 :(得分:1)
试试这段代码,
ViewDidLoad方法:
float delay = 0.1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[UIApplication sharedApplication].statusBarHidden = NO;
ViewWillAppear方法给出以下代码:
[UIApplication sharedApplication].statusBarHidden = NO;
希望它有用
答案 1 :(得分:0)
将以下代码添加到视图控制器:
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
- (BOOL)prefersStatusBarHidden {
return YES;
}
或 在appdelegate.m中写这个
[[UIApplication sharedApplication] setStatusBarHidden:YES];
或添加属性状态栏最初隐藏在plist文件中
Folks,在iOS 7 +中
请将此信息添加到您的info.plist文件中,它会有所不同:)
UIStatusBarHidden UIViewControllerBasedStatusBarAppearance
我不知道是否申请你的情况,但在我的情况下,状态栏出现在我加载UIImagePickerController并更改我的默认屏幕方向。
我修复了这种情况添加application.statusBarHidden = YES;在appDelegate里面这样:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
// Detect if I need to hide the StatusBar (optional)
if (iNeedToHide == YES) {
application.statusBarHidden = YES;
}
return UIInterfaceOrientationMaskLandscape;
}
我希望它能帮到你
答案 2 :(得分:0)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
application.statusBarHidden=YES;
}
或
使用此代码可以帮助您:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
答案 3 :(得分:0)
-(BOOL)prefersStatusBarHidden
{
return YES;
}