ios - Strange behaviour in Collection view -


I have a collection view with 25 cells. For a cell, I have made the text color white I reload the archive, the text color of the other cells also changes one color from one to the other, even after I reload the archive view. I do not know where this problem is my code.

  if (indexPath.item == 0) {myCell.hidden = NO; NSLog (@ "index path =% ld", (long) indexPath.row); NSArray * object = [[jsonData valueForKey: @ "time-timepad"] object objectAtIndex: 0]; NSLog (@ "object% @", object); MyCell.roomLabel.text = [NSString stringWithFormat: @ "Room:% @", [Object ManForque: @ "Room Description"]]; MyCell.subjectLabel.text = [Item Value ForKey: @ "Theme Description"]; [MyCell.redXbuttonOutlet setTag: indexPath.row]; [MyCell.redXbuttonOutlet addTarget: Self action: @Selector (button pressed :) Control events: UIControlEventTouchUpInside]; MyCell.noSessionView.backgroundColor = [UIColor clear collar]; myCell.myLearningChoicesBackground.hidden = Yes; If (([[Object Value: Forecae: @ "Changed"] is Extolstring: @ "Yes"] {If ([[Object Value is Forekey: @ "Changed Caller Code"] Avlastostring: @ "Present"]) {myCell. NoSessionView Background Corner = [UI Collar Color Withride: 97.0 / 255.0 Green: 182.0 / 255.0 Blue: 73 / 255.0 Alpha: 1]; // To change the color of the text, the lines below are written only for the index path 0 myCell.roomLabel.textColor = [UIColor whiteColor]; MyCell.subjectLabel.textColor = [UIColor whiteColor]; }} // Code for other cells if (indexPath.item == 1) {myCell.hidden = NO; NSLog (@ "index path =% ld", (long) indexPath.row); NSArray * object = [[jsonData valueForKey: @ "time-timepad"] object objectAtIndex: 0]; NSLog (@ "object% @", object); MyCell.roomLabel.text = [NSString stringWithFormat: @ "Room:% @", [Object ManForque: @ "Room Description"]]; MyCell.subjectLabel.text = [Item Value ForKey: @ "Theme Description"]; [MyCell.redXbuttonOutlet setTag: indexPath.row]; [MyCell.redXbuttonOutlet addTarget: Self action: @Selector (button pressed :) Control events: UIControlEventTouchUpInside]; MyCell.noSessionView.backgroundColor = [UIColor clear collar]; myCell.myLearningChoicesBackground.hidden = Yes; If (([[Object Value: Forecae: @ "Changed"] is Extolstring: @ "Yes"] {If ([[Object Value is Forekey: @ "Changed Caller Code"] Avlastostring: @ "Present"]) {myCell. NoSessionView Background Corner = [UI Collar Color Withride: 97.0 / 255.0 Green: 182.0 / 255.0 Blue: 73 / 255.0 Alpha: 1]; }} If (indexPath.item == 3) {myCell.hidden = NO; NSLog (@ "index path =% ld", (long) indexPath.row); NSArray * object = [[jsonData valueForKey: @ "time-timepad"] object objectAtIndex: 0]; NSLog (@ "object% @", object); MyCell.roomLabel.text = [NSString stringWithFormat: @ "Room:% @", [object Valid: @ "room description"]]; MyCell.subjectLabel.text = [Item Value ForKey: @ "Theme Description"]; [MyCell.redXbuttonOutlet setTag: indexPath.row]; [MyCell.redXbuttonOutlet addTarget: Self action: @Selector (button pressed :) Control events: UIControlEventTouchUpInside]; MyCell.noSessionView.backgroundColor = [UIColor clear collar]; myCell.myLearningChoicesBackground.hidden = Yes; If (([[Object Value: Forecae: @ "Changed"] is Extolstring: @ "Yes"] {If ([[Object Value is Forekey: @ "Changed Caller Code"] Avlastostring: @ "Present"]) {myCell. NoSessionView Background Corner = [UI Collar Color Withride: 97.0 / 255.0 Green: 182.0 / 255.0 Blue: 73 / 255.0 Alpha: 1]; }}   

// and so on}

anything Not "strange" about this behavior, this is not the result of dealing with cell reuse properly if you set the text inside of that white first, if the clause, but in another color it is again If not set then the Clauses, when that cell is reused, this text will still be set to white. It also appears that the code changes that color Apart from tan, if each of your sections has the same, you should not have everyone for each item either; You have to refact your code to eliminate that code in order to reproduce, if outside of any segment, if you really still need someone, then you only need to color for only 0 items for text and everything else For black color should be set,

  myCell.roomLabel.textColor = (IndexPath.item == 0)? [UIColor whiteColor]: [UIColor blackColor]; MyCell.subjectLabel.textColor = (indexPath.item == 0)? [UIColor whiteColor]: [UIColor blackColor];    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -