0
我想添加一個Logo(UIImageView
)到全屏MPMoviePlayerController。如何將子視圖添加到全屏MPMoviePlayer
當MPMoviePlayerController
未處於全屏模式時,它工作正常。當我切換到全屏時,MPMoviePlayerController
上的所有添加視圖都被刪除(隱藏)。
這裏是我的代碼:
- (void)setupMPMoviePlayer{
[self.moviePlayer.view removeFromSuperview];
[self removeNotifications];
self.moviePlayer = nil;
self.moviePlayer = [[MPMoviePlayerController alloc] init];
[self addNotifications];
[self.moviePlayer.view setFrame:self.view.bounds];
self.moviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
self.moviePlayer.fullscreen = NO;
[self.view addSubview:self.moviePlayer.view];
if ([self.moviePlayer respondsToSelector:@selector(setAllowsAirPlay:)])
[self.moviePlayer setAllowsAirPlay:YES];
[self.moviePlayer setContentURL:[NSURL URLWithString:urlString]];
[self.moviePlayer setFullscreen:YES animated:YES];
[self addLogoViewAtView:self.moviePlayer.view];
}
- (void)addLogoViewAtView:(UIView *)view{
UIView *theView = [view viewWithTag:101];
if (theView.superview) {
[theView removeFromSuperview];
}
UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_weiss.png"]];
logoView.tag = 101;
logoView.frame = CGRectMake(logoView.image.size.width - 100.0,
100.0,
logoView.image.size.width,
logoView.image.size.height);
logoView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
[view addSubview:logoView];
[view bringSubviewToFront:logoView];
}
現在我的問題是有一個子視圖添加到MPMoviePlayerController
的替代方法?
我可以將徽標添加到應用程序的窗口,但這並不是那麼幹淨。
任何人對我如何做到這一點有任何想法?
你有上面介紹模態viewController的示例嗎?我已經測試過它,但它不起作用。 – Zeropointer