不要被巨大的问题推迟...(它主要是代码)。
好的,我有一个导航控制器,它包含一个包含tableView的视图控制器(称为AddClaim)。 如果选择的细胞,这就是所谓的:传递的数组未被popViewControllerAnimated传递...为什么?
EditClaimDetails *detailViewController = [[[EditClaimDetails alloc] init] autorelease];
// Pass the selected object to the new view controller.
detailViewController.selectedIndexPath = indexPath;
detailViewController.newClaimArrayDetails2 = newClaimArrayDetails;
[self.navigationController pushViewController:detailViewController animated:YES ];
这很好地工作,并且示出包含的tableView一个新的视图控制器(它是排他性列表)。
在viewDidLoad中此代码存在EditClaimDetails的:(claimTypeHoldingArray是在头文件中声明的可变数组)
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(pressedBack)];
self.navigationItem.leftBarButtonItem = backButton;
claimTypeHoldingArray = [[NSMutableArray alloc] initWithArray:newClaimArrayDetails2];
基本上是如预期的那样的结果如下:返回按钮显示 - 当按下 - 它调用一个将视图控制器弹出到AddClaim的选择器,claimTypeHoldingArray包含AddClaim中给出的newClaimsArray。
这是didSelectRowAtIndexPath方法的代码的一部分:(claimTypeArray是保持细胞的textLabels阵列)
[claimTypeHoldingArray replaceObjectAtIndex:0 withObject:[claimTypeArray objectAtIndex:indexPath.row]];
这里做的事情是,claimTypeHoldingArray的第一对象被替换什么文本是在单元格的TextLabel。到现在为止还挺好。 (带的NSLog测试)
这是当按下后退按钮的代码:
-(IBAction)pressedBack {
AddClaim *sender = [[[AddClaim alloc] init] autorelease];
sender.newClaimArrayDetails = claimTypeHoldingArray;
[self.navigationController popViewControllerAnimated:YES];
这就是麻烦开始的地方...... 这个动作(据我)应该claimTypeHoldingArray取代newClaimArrayDetails 。 (它这样做)但当视图控制器被弹出,屏幕移回添加声明时,这个数组没有改变! 我做了什么错了?顺便说一句,所有的属性都设置。 这是测试我在viewDidAppear做:
NSLog(@"%@",[newClaimArrayDetails objectAtIndex:0]);
这似乎很合乎逻辑,应该工作,但我得到这个错误,我放置propery声明。 'Addclaim'_ – SEG 2011-05-03 15:27:39
AddClaim之前的资本C中的_expected specifier-qualifier-list? – deanWombourne 2011-05-03 15:32:11
或者您需要#import“AddClaim.h”在顶部附近的某处。那个错误意味着它不知道AddClaim是什么:) – deanWombourne 2011-05-03 15:32:45