ios - Prevent UITableViewCells from dequeue and reload -


I'm currently creating an app that displays the user's profile for that purpose, Used a UTable watchclub with custom cells for data (phone number, mail address, etc ...). The maximum maximum of 8 cells per profile.

The user is allowed to edit his profile in an easy way when the edit mode of the tableview is triggered, all editable labels are replaced by the textfield and then the labels are returned to the end Returned

Homeware, there may be a problem in those cells which are not visible. Every time they are appearing again, they are reloaded, setEditing: Yes method is resumed, etc. ... For this reason, every change made in the textfield has been lost.

Do any stop table views to remove non-visible cells and add them back? There are only eight cells, so it will not be able to consume resources, and I will not make any changes every time.

PS: I have tried many things with dequeueReusableCellWithIdentifier method and the identifier of each cell, but I have not succeeded in achieving what I want to achieve. Every time I hide a cell, its contents are fresh.

In this case, you have UITableView `reusability (reusable is a big thing in most cases ) But there will be much difficulty in the conservation of edits. You can avoid reusability and prepare your cells before hand.

Add NSMutableArray iVar or Attribute to your ViewController

  @property (nonatomic, strong) NSMutableArray * cell;  

Deedload in your scene: Make your cells without any ready for the user again

  - (zero) viewDidoadload [[Super Viewedload]; // Setup an additional after loading the view // Creates table visual cells [self-generated seals]; } - (zero) createCells {self.cells = [NSMutableArray array]; TCTime cell * timetime = [[TCTIMEL ALLOCK] InitAttagital: @ "Call" for the timecards: _ timecard and timer entry type: TCTImInternet call]; [_cells addObject: cellCallTime]; TCTime cell * CellLockOut = [[TCTIMEL ALLOCK] Init Vitalical: @ "Launch Start" for TimeCard: _Timecard and TimeInterity Type: TCTimeInterly LaunchOut]; [_cells addObject: cellLunchOut]; TCTEmexcel * Cell Lunch In = [[TCTimeel Alloc] Init Vitalical: @ "Lunch and Time" for Timecade: _TynaCard and TIMEInterity Type: TCTImInterity Launch In]; [_cells addObject: cellLunchIn]; TCTime cell * Selsecondolite = [[TCTermameel Elok] Init Vitalical: "2 mile start" for the timecards: _Taincard and TimeInternetype: TCTM EnterprisesSecond Mellaut]; [_cells addObject: cellSecondMealOut]; TCTimexcel * Selsecondiamial in = [[TCTimemeel Elok] Init Vitalical: @ "2 Miles End" for @ Timecard: _Taincard and TimeInterity Type: TCTImInterpept TypingMial In]; [_cells addObject: cellSecondMealIn]; TCTime cell * selwegetime = [[TCTimemax alloc] InitvitTitle: @ @ timecode for "Rapp: _ timecards and timer entry type: TCTMInterflyPup;; [_cells addObject: cellWrapTime];}  

This table can populate your table view.

  - (NSInteger) table view: (UITableView *) table view numberofrease ins: section (refresh self.cells.count;} - (UITableViewCell *) TableView: (UITableView *) Table View CellForAindindPay : (NSIndexPath *) indexPath {Return self.cells [indexPath.row];}  

If you have a section table view, you can set your cells to array of arrays In that case, your data source methods should look like the following

  - (NSInteger) numberOfSectionsInTableView: (UITableView *) table view {return [ Self.cells count];} - (NSInteger) TableView: (UITableView *) table view numberoffrose injection: (NSInteger) section {return [self.cells [section] count]; } - (UITableViewCell *) TableView: (UITableView *) Table View CellForAind Pound: (NSIndexPath *) Indexing Path {Return Self.cells [indexPath.section] [indexPath.row]; }  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -