在iPhone应用程序中,我有一个表格视图,其单元格内有一些数据(UITextField,UITextView)。当你触摸单元格时,我需要将这些数据(UITextField,UITextView)设置为另一个视图中的textfield和textView并打开该视图。iphone用表格单元格触摸数据打开新窗口
使用此代码,它会打开触摸事件的新观点上的细胞,但它没有加载数据 因为我从这些行预计:
[obsevationListView setTitle:titletxt];
[obsevationListView setTxtView:titletxt];
希望有人能帮助我用一个简单的例子。
谢谢...
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
// NSIndexPath *aIndex = [NSIndexPath indexPathForRow:0 inSection:1];
// return aIndex; //return nil so the cell is not selected
NSLog(@"cell is selected %d >> %d",(int)indexPath, indexPath.row);
Observation *observer = (Observation *)[observations objectAtIndex:indexPath.row];
NSLog((NSString *)observer.title);
ObsevationListView *obsevationListView = [[ObservationViewControllor alloc]
initWithNibName:@"ObservationViewControllor"
bundle:nil];
NSString *titletxt = [[NSString alloc] initWithFormat:@"Hello, %@!", observer.title];
[obsevationListView setTitle:titletxt];
[obsevationListView setTxtView:titletxt];
// UITextView *textView;
// UITextField *messageTitle;
[self.navigationController pushViewController:obsevationListView animated:YES];
return indexPath;
}
我用didSelectRowAtIndexPath方法方法,但它实际上并没有工作,我需要用装载打开新视图一些细节 例如:我显示了在表视图观察草案的列表,当我点击一行,我想将观察草稿加载到编辑视图的字段中,但我使用相同的窗口用空字段进行新的观察。 我应该使用编辑视图的init方法中的条件吗?有人请指导我在Java中,我可以使用重载的构造函数做到这一点我如何设想在Iphone应用程序中做到这一点?
我用didSelectRowAtIndexPath方法方法,但它没有工作 – 2011-06-06 04:52:29