Reputation: 5
I want to do some operation in a particular cell using some function.
Here i used button in custom cell to call this function. Each button has cell index value as title. Using that title only, I can identify a particular cell to do some operation.
-(void)showInteractionView:(id)sender{
UIButton *btn=(UIButton *)sender;
lastSelInteractionVal=[btn.titleLabel.text intValue];
NSIndexPath *index=[NSIndexPath indexPathForRow:[btn.titleLabel.text intValue] inSection:0];
UITableViewCell *cell=[tblView cellForRowAtIndexPath:index];
UIView *v=(UIView *)[cell.contentView viewWithTag:INNERVIEW];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
v.frame=CGRectMake(0, 0, 320, 100);
[UIView commitAnimations];
}
But here I used custom cell so I want to assign tblView
cell to a custom cell instead of this code below.
UITableViewCell *cell=[tblView cellForRowAtIndexPath:index];
Please give me a solution.
Thanks.
Upvotes: 0
Views: 519
Reputation: 28750
The same way you can get custom cell.
YourCustomCell *customCell = [tblView cellForRowAtIndexPath:index];
or you can do this
id Cell = [tblView cellForRowAtIndexPath:index];
if([cell isKindOfClass[yourCustomCellClassName class]]){
NSLog(@"Custom Cell Found");
}
Upvotes: 2