It can be solved by using keeping a reference of your previously selected cell.
Declare a variable in your .m file, like:
static PositionTableCell *previousCell = nil;
And modify your method like:
- (IBAction)btnEdit:(id)sender
{
if (previousCell != nil && previousCell != self)
{
for (id subLabel in [[previousCell contentView] subviews])
{
if ([subLabel isKindOfClass:[UILabel class]])
{
UILabel *tempLabel = (UILabel *)subLabel;
tempLabel.layer.borderColor = [UIColor clearColor].CGColor;
tempLabel.layer.borderWidth = 0;
tempLabel.userInteractionEnabled = NO;
isRowSelected = NO;
isSelected = NO;
}
}
}
// Other codes here
}