PDA

View Full Version : Button images in cellForRowAtIndexPath are not getting refreshed




RashiMahajan
Nov 22, 2009, 09:36 AM
Hi,
In my prgm, i am displaying button to some filtered rows of the table in "cellForRowAtIndexPath", for first few rows it display the button to the filtered rows bt as i scroll up, some other rows which dont satify the filetring condition also display the button


What i think they dispying the button images coz if previous rows cell contained the images ......
please help me :(



sneha
Nov 23, 2009, 02:36 AM
Can you post code of


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
}



so we can help you properly

Thanks :)

RashiMahajan
Nov 23, 2009, 04:42 AM
So nice of u sneha :)
i will post the code soon bt lpz be there to help me :)

RashiMahajan
Nov 23, 2009, 08:18 AM
if([some condition])
{
UIButton *indicator = [[UIButton alloc]initWithFrame:CGRectMake(10, 30, 40, 40)];
[indicator setBackgroundColor:[UIColor greenColor]];
[indicator addTarget:self action:@selector(selectionBtnClick:) forControlEvents:UIControlEventTouchUpInside];
indicator.tag=indexPath.row;
[ cell.contentView addSubview:indicator];
[indicator release];
}

This is my code inside "cellForRowAtIndexPath" Now for first 5-6 records its display the button properly if row specifies the condition But when i scroll up in table view , for new rows which don't specify the condition, even they display the button & if i press the button , it traces the previous buttons tag :(
So i am not able to get teh fresh new table rows whn i scroll up the table :(