2012-06-07 80 views
0

我有一個應用程序,我在桌面單元格中添加嵌入的YouTube視頻。在tableview的左側有一個複選框可供選擇特定的視頻。當我點擊單元格播放特定視頻通過嵌入式視頻播放的視頻時。但我希望當我點擊完成按鈕的YouTube視圖時,它應該返回到相同的列表頁面和行高特定的單元格應該通過其中的2個按鈕增加高度。當我點擊完成按鈕時,我能夠返回到同一個tableview頁面,但是prob是播放的視頻的行高不增加,按鈕也不是可見。請幫助我解決這個問題。謝謝。這是我的代碼返回到相同的tableview頁面時,點擊完成按鈕的視頻:如何增加iPhone中的特定單元格的行高,並將按鈕添加到增加的單元格

-(void)playVideo:(NSString *)urlString frame:(CGRect)frame 
{ 
    NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: red;\ }\ </style>\ </head><body style=\"margin:0\">\ <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ width=\"%0.0f\" height=\"%0.0f\"></embed>\ </body></html>"; 
    NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height]; 
    videoView = [[UIWebView alloc] initWithFrame:frame]; 
    [videoView loadHTMLString:html baseURL:nil]; 


} 


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 


     static NSString *CellIdentifier = @"Cell"; 
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

     if (cell == nil) 
     { 
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 

     } 


     ArchiveModal *AM = (ArchiveModal*)[DatafromArchModal objectAtIndex:indexPath.row] ; 


     NSLog(@"%i",AM.VideoId); 
     [self playVideo:AM.ArchUrl frame:CGRectMake(60, 20, 200, 100)]; 
     //this function is for embedding video and playing video 
      [[NSNotificationCenter defaultCenter] 
     addObserver:self 
     selector:@selector(windowNowVisible:) 
     name:UIWindowDidBecomeVisibleNotification 
     object:self.view.window 
     ]; 


     [[NSNotificationCenter defaultCenter] 
     addObserver:self 
     selector:@selector(windowNowHidden:) 
     name:UIWindowDidBecomeHiddenNotification 
     object:self.view.window 
     ]; 




} 

-(void)didselectrowAtindexPath 
{ 

    [self playVideo:AM.ArchUrl frame:CGRectMake(60, 20, 200, 100)]; 

} 

//這就是所謂的通知時,完成按鈕是cliked.Here我打電話相同的tableview列表頁面時完成按鈕是cliked.But我想,當完成按鈕被點擊同一頁面應該被調用,但是已經播放的特定單元格的行高應該增加高度,並且還應該將2個按鈕添加到該特定行中。

回答

1
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [self addButton]; 
    return 50; //returns height of row 
}  

創建按鈕:

-(void)addButton 
{ 
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    [button addTarget:self action:@selector(callYourMethod:) forControlEvents:UIControlEventTouchDown]; 
    [button setTitle:@"Show View" forState:UIControlStateNormal]; 
    button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); 
    [view addSubview:button]; 
    [button release]; 
} 
+0

其實這不是我想要的 – user1436626

相關問題