我正在尝试开发一个iOS应用,但是我在类之间传递数据方面遇到了问题。
这是我的第二个应用程序。第一个应用程序使用了全局类,但现在我需要多个类。我尝试了很多教程,但是都不起作用或者传递的值始终为零。请问有人能写一个简单的应用程序来演示在iOS 5中传递变量吗?
没有什么特别的,只有两个视图控制器的故事板,一个变量。
感谢您的帮助。
感谢您的帮助。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
FirstViewController *fv;
fv.value = indexPath.row;
NSLog(@"The current %d", fv.value);
FirstViewController *detail =[self.storyboard instantiateViewControllerWithIdentifier:@"Detail"];
[self.navigationController pushViewController:detail animated:YES];
}
这是来自我的主视图的代码,我需要将我按下的单元格的indexPath.row或索引发送到下一个视图。