我想让showEventDate方法像下面的tableview那样传递数据,我怎么能做到呢?我不能在这个方法中放入indexPath。谢谢。
-(void)showEventDate
{
EventView *rvc = [[EventView alloc]initWithNibName:@"EventView" bundle:nil];
[navController pushViewController:rvc animated:YES];
[rvc release];
}
// Display a details screen for the selected holiday/row.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Event *holiday = [dataSource holidayAtIndexPath:indexPath];
HolidaysDetailViewController *vc = [[[HolidaysDetailViewController alloc] initWithHoliday:holiday] autorelease];
[navController pushViewController:vc animated:YES];
}
我假设你想要indexRow从一个UITableView传递给showEventDate。我要试一试。首先实现委托方法didSelectRowAtIndexPath。然后将'indexPath'传入你想要的地方:例如,showEventdate。
-(void)showEventPath: (NSIndexPath *)indexPath
{
// your code here...
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self showEventPath:indexPath];
}