- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UIViewController *destinationViewController = segue.destinationViewController;
if ([destinationViewController respondsToSelector:@selector(setString:)]) {
// TaskDetailViewController *VC = (TaskDetailViewController *)destinationViewController;
// VC.delegate = self;
NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
// VC.string = [self.taskArray objectAtIndex:indexPath.row];
// VC.indexpath = indexPath;
//KVC
[destinationViewController setValue:self forKey:@"delegate"];
[destinationViewController setValue:[self.taskArray objectAtIndex:indexPath.row] forKey:@"string"];
[destinationViewController setValue:indexPath forKey:@"indexpath"];
}
}
UIViewController *destinationViewController = segue.destinationViewController;
if ([destinationViewController respondsToSelector:@selector(setString:)]) {
// TaskDetailViewController *VC = (TaskDetailViewController *)destinationViewController;
// VC.delegate = self;
NSIndexPath *indexPath = [self.tableView indexPathForCell:sender];
// VC.string = [self.taskArray objectAtIndex:indexPath.row];
// VC.indexpath = indexPath;
//KVC
[destinationViewController setValue:self forKey:@"delegate"];
[destinationViewController setValue:[self.taskArray objectAtIndex:indexPath.row] forKey:@"string"];
[destinationViewController setValue:indexPath forKey:@"indexpath"];
}
}
本文深入探讨了Swift编程语言在iOS应用开发中的核心技巧,包括面向对象编程、函数式编程、事件驱动编程等现代编程范式。通过实例分析,读者可以掌握如何利用这些技巧提高代码质量和效率。
342

被折叠的 条评论
为什么被折叠?



