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