How to show subtitle above video with an overlay view on iOS?
Asked
Active
Viewed 1,797 times
2 Answers
2
You can create an overlay view using UILabel to show subtitle as below
//Overlay View
UILabel *lblOverlayView = [[UILabel alloc] init];
lblOverlayView.frame = CGRectMake(0, 459, 320, 21);
lblOverlayView.backgroundColor = [UIColor yellowColor];
lblOverlayView.alpha = 0.3f;
lblOverlayView.text = @"Video Subtitle";
then you can add it as a subview to the view of MPMoviePlayerController to show a subtitle while playing the video.
[_mpMoviePlayerController.view addSubview:lblOverlayView];
here, _mpMoviePlayerController is an object of MPMoviePlayerController. Hope this will help you to fulfill the requirements.

Kapil Mandlik
- 174
- 1
- 1
-
thanks, at last I finally realized this function. thanks Kapil Mandlik, thanks internet,thanks everybody. – libai Jul 04 '11 at 12:54
-
your code is working, but your CGRectMake(0, 459, 320, 21); will likely go off visible area of iPhone screen in landscape mode. – bialix Apr 04 '13 at 09:06
1
Add a subview to the view showing the video and put it in front. This might help:
[myView bringSubviewToFront: subtitleView];

dasdom
- 13,975
- 2
- 47
- 58