How To detect the UItable Section
<p>I have a small problem:</p>

<p>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 .</p>

<p>I can track the indexPath by using :</p>

<pre><code> myVar = [sender tag];
</code></pre>

<p>How can I track section? Please help.
Thanks in advance.</p>

<p>This method will be called when I tap the UIButton:</p>

<pre><code>        [playPreviewButton addTarget:self action:@selector(**playPreviewButtonClicked**:) forControlEvents:UIControlEventTouchUpInside];
</code></pre>

<p>"playPreviewButtonClicked" method get called from each section when I tab the UIButton</p>

<pre><code>            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&lt;[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];
            }
</code></pre>

<p>**</p>

<p>where previewTapped = [sender tag]</p>

<p>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. </p>
