下面我有該委託方法在我的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!非常感謝。工作完美:) –