When there are two types of cells, the following magical events occur:
Reason:
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{Userinfocell*cell =[TableView Dequeuereusablecellwithidentifier:kcellidentifier_userinfocell Forindexpath:indexpath]; Pdoptioncell*optioncell =[TableView dequeuereusablecellwithidentifier:optioncellid Forindexpath:indexpath]; if(Indexpath.section = =0) { Switch(indexpath.row) { Case 0: [Cell setuserinfowithimage:@"Mine_rec_name"Title:@"real name"Info:_login_user.cur_user.realname]; returnCell; Break; Case 1: [Cell setuserinfowithimage:@"Mine_rec_num"Title:@"ID Number"Info:_login_user.cur_user.id_card]; returnCell; Break; Case 2: {//Nsindexpath *index = [Nsindexpath indexpathforrow:2 insection:0];[Optioncell reconstructsubviewsundermode:optioncellmodepic];//[Self.mytableview Reloadrowsatindexpaths:[nsarray Arraywithobject:index] Withrowanimation:uitableviewr Owanimationautomatic]; returnOptioncell; } Break; }
Called the
dequeuereusablecellwithidentifier: forindexpath:
In the reuse mechanism, this method repeats the call two times.
Causing the reuse to go awry, when there is only one cell, to perceive that this is not the case,
But once there are multiple cells, it must lead to reuse errors!
So the solution: Swap
Dequeuereusablecellwithidentifier:
Method
The results are as follows:
TableView Cell Repeat Add