I'm trying to add Spinner to Like button that I have positioned in my tableViewCell. But the problem is spinner is showing outside the tableViewCell.
This is how I implemeneted my code inside cellForRowAtIndexPath
myspinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[myspinner setCenter:cell.like.center];
[cell.like addSubview:myspinner];
And when I click using sender.tag
[myspinner startAnimating];
Problem is spinner working but not as I wanted. It's showing outside the cell.
UPDATE
With matt
's answer It did work.
also i changed my code like below. inside selector action. -(void) likeClicked:(UIButton*)sender
UIActivityIndicatorView *myspinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[myspinner setCenter: CGPointMake(CGRectGetMidX(sender.bounds),
CGRectGetMidY(sender.bounds))];
[sender addSubview:myspinner];
[myspinner startAnimating];