![](/img/trans.png)
[英]Why iOS Simulator show my app as I want and my iphone doesn't show anything?
[英]My iPhone App doesn't work in iOS 4. Why?
我制作了一個可以顯示一些視頻的iPhone應用程序。 我使用Xcode 3.2.2和iPhone SDK 3.1.3實現了它,並且工作正常。 但是幾天前,我下載了適用於iOS 4的iPhone SDK的最新版本。該項目構建良好,沒有錯誤,沒有警告,但是當我運行復制操作時,視頻無法正常工作,圖像沒有加載但聲音正常作品。 我不明白
這是我使用的代碼。
NSBundle *Bundle = [NSBundle mainBundle];
NSString *moviePath = [Bundle pathForResource:@"Prueba" ofType:@"mp4"];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeFill;
[theMovie play];
有人有主意嗎?
最好的祝福。
有一個新的MPMoviePlayerViewController for 3.2(ipad)和更高的iOS4版本
DevForum中的更多說明https://devforums.apple.com/message/207339#207339
您需要將電影播放器的視圖嵌入到自己的視圖中才能觀看視頻:
UIView * myView = ...
UIView * movieView = [moviePlayer視圖];
[movieView setFrame:[myView bounds]]; //使影片適合myView的確切范圍
[myView addSubview:movieView];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.