Wednesday 22 July 2015

[iOS] StatusBar disappear after playing video

A small problem is after the MPMoviePlayerController plays the video, the status bar disappears. We can see the status bar is lack of time, battery notice… It may cause some other bugs such as the frame is calculate wrong.
The problem is the controlStyle of the MPMoviePlayerController. Except using MPMovieControlStyleFullscreen, use MPMovieControlStyleEmbedded
Reference:
—————–
Tuy nhien, MPMovieControlStyleEmbedded sẽ không có nút Done cho người dùng nếu họ muốn stop video đang chạy.
Nguyên nhân là do bị mất status bar. Do đó, khi FinishPlayingVideo, ta thêm 1 dòng code để hiện lại status bar. 
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delay * NSEC_PER_SEC), dispatch_get_current_queue(), ^{
        [UIApplication sharedApplication].statusBarHidden = NO;
    });
Reference:
Dung Nguyen

No comments:

Post a Comment