2013-03-19 101 views
3

我有一個包含6個菜單一日一個包含UIViewController第二包含UITableView如何訪問的tableview細胞

當我點擊了新的一頁出現的第一個單元格,它包含一個按鈕 當我點擊這個按鈕我想要訪問菜單中的第二個單元格,其中包含一個tableView

+1

我不明白你問什麼..Please與培訓相關信息編輯你的問題,你想實現等 – 2013-03-19 10:24:36

回答

3

儘可能多的我明白你的問題,你想從tableview移動到其他視圖上點擊..所以,你必須使用類似的代碼。 。

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

    Detail *img1=[[Detail alloc]initWithNibName:@"Detail" bundle:Nil]; 
    img1.labelString = [titleArray objectAtIndex:indexPath.row]; 
    [self presentViewController:img1 animated:YES completion:nil];  
} 
+1

只是改變了什麼這裏的參數...並檢查...如果沒有成功,讓我知道.. – Shivaay 2013-03-19 10:30:37

1

在您的UIButton Tapped Method中寫下以下字母。

-(void) ButtonTapped:(UIButton *) sender 
{ 
     NSIndexPath *indexpathNew = [self.tblView indexPathForCell:(UITableViewCell *)[sender superview]]; 

     NSLog(@"%@",indexpathNew.row); 
} 

indexpathNew是小區的選擇的按鈕的返回indextPath

試試我的代碼我可能會對你有所幫助。

4

//使用這個代碼,刷新或刪除或插入TableviewCell

// reloading cell 
NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0]; 
     [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationTop]; 

// inserting cell 
NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0]; 
     [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationTop]; 

// deleting cell 
NSIndexPath *tmpIndexpath=[NSIndexPath indexPathForRow:0 inSection:0]; 
     [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:tmpIndexpath, nil] withRowAnimation:UITableViewRowAnimationBottom]; 
+0

@ kiokio:你可以分享應用屏幕​​截圖。它是如何出現的?所以我可以幫你 – 2013-03-19 11:56:05