0
我有多个.xib文件和多个视图控制器。数据备份切换视图控制器IOS
问题是当我从子视图传递数据到父视图控制器时,数据成功通过。但是,当我切换到另一个子视图,并回到已经通过损失的父视图控制器数据。
我将数据保存在一个NSMutablearray中,所以我应该如何备份传递的数据,以便在切换视图时不会丢失数据?
ForStand Button是NSMutablearray,用于保存来自子视图的传入数据,如下所示,当我切换到另一个子视图并返回主视图时,它将变为空。
下面是示例输出:
2012-03-06 13:44:38.184 Avicii[726:b603] ForStand Button = '(null)'
server did not accept client registration 68
2012-03-06 13:44:41.809 Avicii[726:b603] StandLocations (
"Point Stand",
"Near Stand"
)
2012-03-06 13:44:43.252 Avicii[726:b603] ForStand Button = 'Near Stand'
server did not accept client registration 68
2012-03-06 13:44:56.984 Avicii[726:b603] ForStand Button = '(null)'
server did not accept client registration 68
在子视图数据传递如下:
- (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
StartHuntViewController *startHuntController = [[StartHuntViewController alloc] initWithNibName:@"StartHuntView" bundle:nil];
startHuntController.forStandButton = [stands objectAtIndex:indexPath.row];
startHuntController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:startHuntController animated:YES];;
// startHuntController.standLocation.text=[stands objectAtIndex:indexPath.row];
[startHuntController release];
startHuntController =nil;
}
在父ForStand被initilazed如.H
@property (nonatomic, retain)NSMutableArray *forStandButton;
以下
在.M
@synthesize forStandButton;
制作新单在课上它是 – 2012-03-08 01:21:16