1

我有一個問題,顯然是基本的。我有一個應用程序,它有一個帶有視頻的多媒體部分(Youtube或Ted)。Youtube和模態意見

當你選擇一個視頻(TableView中),我打開一點點描述一個模式的看法,如果它是一個YouTube視頻,網頁視圖,你必須點擊它打開視頻。在另一種情況下,我使用MPMovieController。

,我的問題是,在YouTube視頻。當我關閉播放器時,我的模式視圖也被關閉,其餘應用程序使用模態視圖不起作用(它不打開模態視圖)。

這裏說明視圖代碼:

- (void)viewDidLoad{ 

[super viewDidLoad]; 

NSRange range = [sendVideo rangeOfString:@"youtube"]; 


if(range.length>0){ 


    NSString *htmlString =[NSString stringWithFormat:@"<html><head>" 
          "<meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 212\"/></head>" 
          "<body style=\"background:#F00;margin-top:0px;margin-left:0px\">" 
          "<div><object width=\"212\" height=\"172\">" 
          "<param name=\"movie\" value=\"%@\"></param>" 
          "<param name=\"wmode\" value=\"transparent\"></param>" 
          "<embed src=\"%@\"" 
          "type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"212\" height=\"172\"></embed>" 
          "</object></div></body></html>",sendVideo,sendVideo]; 



    [youtube loadHTMLString:htmlString baseURL:nil]; 



} 

else 

{... 

下面是我用TableView中選擇視頻代碼:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 


if(videosContenido ==YES){ 



    VerDetalles *vd = [[[VerDetalles alloc]initWithNibName:@"VerDetalles" 

                bundle:nil]autorelease]; 



    vd.sendTitle = [aux2 objectAtIndex:[indexPath row]]; 

    vd.sendDesc = [aux6 objectAtIndex:[indexPath row]]; 

    vd.sendVideo = [aux4 objectAtIndex:[indexPath row]]; 

    UINavigationController *navController= [[[UINavigationController alloc] 

              initWithRootViewController:vd]autorelease]; 

    if(navController){ 

     navController.modalPresentationStyle = UIModalPresentationFormSheet; 

     navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 

    }else { 

     [tableView deselectRowAtIndexPath:indexPath animated:YES]; 

    } 

    [self presentModalViewController:navController animated:YES]; 

} 
+0

你怎麼解僱模態視圖控制器... – iDroid 2012-03-16 10:28:10

+0

我有一個按鈕,我叫[self.navigationController dismissModalViewControllerAnimated:YES];與特德視頻是好的,但與Youtube視頻......它消除了模態視圖,但是當我嘗試去模式視圖的其他部分它不會打開。 – 2012-03-16 10:38:37

+0

您在創建行選擇時正在創建導航控制器,但您試圖像訪問成員變量self.navcontroller那樣訪問它?.......... – iDroid 2012-03-16 10:41:14

回答

0

我有完全相同的問題。我注意到,沒有在我的應用程序委託中設置window.rootViewController屬性解決了這個問題。 (只需調用[window addSubview:rootViewController.view])。但是,在iOS 6中,未設置窗口的rootViewController時,自動轉換不起作用。 ?