Hi friends, I have a small problem:
I have a table with two sections. Both sections contains UIButtons on each of their corresponding cells. Clicking on these buttons plays the song. While song plays animation goes on. My problem is when I tab on button of any of the section then animation starts in both the section. Now I want to know how can I detect on which section button is pressed so that animation can work only in the section in which button is clicked .
I can track the indexPath by using :
myVar = [sender tag];
How can I track section? Please help. Thanks in advance.
This method will be called when I tap the UIButton:
[playPreviewButton addTarget:self action:@selector(**playPreviewButtonClicked**:) forControlEvents:UIControlEventTouchUpInside];
"playPreviewButtonClicked" method get called from each section when I tab the UIButton
if(previewTapped==[indexPath row])
{
//display the animation wala stuff
[secondImageView removeFromSuperview];
[testView addSubview:firstImageView];
[cell.contentView addSubview:testView];
//Following statements will control the animation on scrolling.
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
for(loopCounter = (songPreview.currentTime/animationCounter)+1; loopCounter<[animationImagesArray count]; loopCounter++)
{
[tempArray addObject:[animationImagesArray objectAtIndex:loopCounter]];
}
firstImageView.animationImages = tempArray;
[firstImageView setAnimationRepeatCount: 1];
firstImageView.animationDuration = (songPreview.duration)-(songPreview.currentTime);
[firstImageView startAnimating];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView commitAnimations];
}
**
where previewTapped = [sender tag]
My problem is when I tab button in any section then animation starts in both the sections. above "if" statement executed whenever cell created on scrolling the table.