下面我有该委托方法在我的tableview设置几个领域,从代表的UITableViewCell编辑。会发生什么情况是,当一个tableview单元格被按下时,当一个被选中的时候,它会加载一个包含更多tableview单元格的子视图,从视图控件中弹出视图并将选定的值加载到最初选择的父视图单元格中。努力工作不
这主要细胞的影响是什么,我能够在第二单元设置。所以当它被点击时,它显示与第一选择相关的数据。
我让我的用户返回到任何细胞改变他们的选择..或者他们可能会去思考他们想改变,但没有。
在这种情况下,我parentview的第二tableviewcell要么需要,如果第一个单元格变化而改变或保持不变,如果第一个单元格dosnt变化值。
我有这个代理所使用与第一小区,并且它是我在哪里试图控制secondcell的值,如下所示。
- (void) setManufactureSearchFields:(NSArray *)arrayValues withIndexPath:(NSIndexPath *)myIndexPath
{
manufactureSearchObjectString = [[arrayValues valueForKey:@"MANUFACTURER"] objectAtIndex:0];
manufactureIdString = [[arrayValues valueForKey:@"MANUFACTURERID"] objectAtIndex:0]; //Restricts Models dataset
manufactureResultIndexPath = myIndexPath;
[self.tableView reloadData]; //reloads the tabels so you can see the value in the tableViewCell.
//need some sort of if statment here so that if the back button is pressed modelSearchObjectString is not changed..
if (oldManufactureSearchObjectString != manufactureSearchObjectString) {
modelResultIndexPath = NULL;
modelSearchObjectString = @"empty";
oldManufactureSearchObjectString = manufactureSearchObjectString;
}
}
的东西存在是它进入,如果statment即使同一小区被选择用于第一小区的每一次..(在这种情况下是不应该进入if语句。
我想我可以通过检查oldMan vrs man来做到这一点,如果!=然后通过设置第二个单元格的东西,然后将man传给oldMan,所以下次你使用第一个单元格时,它有一个值得攻击的值,但显然这个dosn't似乎是工作。我是坏的逻辑或者是它的东西在我的代码。
这就是我在.H设置这些值,他们都@synthesised
//...
NSString *manufactureSearchObjectString;
NSString *oldManufactureSearchObjectString;
NSString *manufactureIdString;
NSIndexPath *manufactureResultIndexPath;
//...
@property (copy) NSString *manufactureSearchObjectString;
@property (copy) NSString *oldManufactureSearchObjectString;
@property (copy) NSString *manufactureIdString;
@property (copy) NSIndexPath *manufactureResultIndexPath;
//...
BOOM!非常感谢。工作完美:) –