Trying to edit uitableviewcell from delegate not working?

You have to compare the value of the NSStrings as below.

Up vote 0 down vote favorite share g+ share fb share tw.

I have this delegate method below that is setting a few fields in my tableview. What happens is when one of the tableview cells is pressed it loads a subview with a bunch more tableview cells when one is selected is pops the view from the viewcontrollerand loads the value that was selected into the parentviews cell that was initially selected. This main cell effects what I am able to set in the second cell.

So when it is clicked it shows data related to the first selection. I am enabling my user to go back to any of the cells to change their selection.. or maybe they might go back thinking they want to change but don't. In which case for the second tableviewcell of my parentview will either need to change if the first cell changes or stay the same if the value of the first cell dosnt change.

I have this delegate that is used with the first cell, and it is where I am trying to control the value of the secondcell, as shown below. - (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; } } The thing being is that it enters the if statment every time even if the same cell is selected for the first cell.. (in which case is should not enter the if statement. I thought I could do this by checking oldMan vrs man if!

= then go through and set the second cell stuff and then pass man to oldMan so next time you use the first cell it has a value to comapre against. But obviously this dosn't seem to be working. Is my logic bad or is it something in my code.

This is how I set these values in . H they are all @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; //... iphone ios uitableview uitableviewcell link|improve this question asked Nov 2 '11 at 22:05C. Johns898219 76% accept rate.

You have to compare the value of the NSStrings as below: BOOL isEqual = aString isEqualToString:bString; // provide aString and bString if (!isEqual) { // code } What you've done is to compare the pointers, which can be different for strings of the same value.

BOOM! Thank you so much. Worked perfectly :) – C.

Johns Mar 20 at 19:47.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions