Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableviewcell content updating reflects to other cell
    text
    copied!<p>I am using 8 cells in a tableview. Each cell having group of components like UIButton, UILabel and UISlider. When I update 6th cell, it reflects to 1st cell. Similarly, if I update 7th cell, it reflects to 2nd cell.</p> <p>Delete cell code:</p> <pre><code>{ [buttonarray removeObjectAtIndex:delpath.row]; viewcount--; ListCell1 *cell=(ListCell1 *)[table cellForRowAtIndexPath:delpath]; cell.slider.value=0; cell.qlabel.text=@"1"; cell.slabel.text=@"1"; cell.n=1; [cell.button1 setTitle:@"240" forState:UIControlStateNormal]; for (int m=0; m&lt;7; m++) { [[cell.myarray objectAtIndex:m]setImage:[UIImage imageNamed:@"Num2.png"] forState:UIControlStateNormal]; UIButton *but=[cell.myarray objectAtIndex:m]; but.tag=0; } [self-&gt;table deleteRowsAtIndexPaths:[NSArray arrayWithObjects:delpath, nil] withRowAnimation:UITableViewRowAnimationFade]; [table reloadData]; delpath=NULL; } </code></pre> <p>when pressing button </p> <pre><code>-(void)buttonpressed:(id)sender { viewcount++; table.delegate=self; table.dataSource=self; //UIView *middleview=[[UIView alloc]initWithFrame:CGRectMake(100,200,300,200)]; [buttonarray addObject:sender]; [table reloadData]; } </code></pre> <p>Code for tableview</p> <pre><code>-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return viewcount; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *MyIdentifier=@"mycell"; ListCell1 *cell = (ListCell1 *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { cell = [[ListCell1 alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; UIButton *b=[buttonarray objectAtIndex:indexPath.row]; cell.imageView.frame=CGRectMake(0, 0, 0, 0); b.imageView.frame=CGRectMake(0, 0, 30, 30); cell.imageView.image=b.imageView.image; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; ListCell1 *cell1 = (ListCell1 *)[tableView cellForRowAtIndexPath:indexPath]; [cell1 addSubview:delbutton]; delpath=indexPath; return; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 100.0; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload