我有一張桌子。當我點擊單元格時,應該執行。我嘗試使用prepareForSegue
和performSegueWithIdentifier
,但沒有任何結果。 我的代碼:表格單元segue
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"OpenB"]){
OpenBViewController *controller = (OpenBViewController *)segue.destinationViewController;
controller.address = self.selectedCellText;
[self performSegueWithIdentifier:@"OpenB" sender:self];
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
self.selectedCellText = [[[tableView cellForRowAtIndexPath:indexPath] textLabel] text];
[self performSegueWithIdentifier:@"OpenB" sender:self];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
刪除'[self performSegueWithIdentifier:@「OpenB」sender:self];'in' prepareForSegue' – Larme
done。沒有結果 – STBY
你是否通過方法編碼?任何斷點或NSLog? – Larme