objective c - Data in UITableViewCell getting cleared when scrolling -
When scrolling table view, all data are returned to default data. I searched the stackoverflow for this problem, but I can not solve my problem Please help me
  - (UITableViewCell *) TableView: (UITableView *) Table View CellForOutPath: (NSIndexPath *) Index path {MTTableViewCell * cell = (MTTableViewCell *) [tableview dequeueReusableCellWithIdentifier: CellIdentifier]; [cell.mainLabel setText: [NSString stringWithFormat: @ "_"]] ;; Return cell; }     
  You are setting the cell's  mainLabel.text  Whenever the  -cellForRowAtIndexPath:  method is called, this is the reason why the data is always being reset to the scroll. In order to deal with this, you should be keeping track of the entry data in  UITextField  or  UITextView  and the setting that is  for mainLabel.text .   There is an example of something that could work, but then it depends how the cell works, if you provide some additional information, it will help me to give a full answer. . >  - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {MTTableViewCell * cell = (MTTableViewCell *) [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; If ([cell.someTextField.text is EqualToString: @ ""]) {[cell.mainLabel setText: [NSString stringWithFormat: @ "_"]]; } Return cell; }    
 
Comments
Post a Comment