2012-06-07 77 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

相关问题