I\'m getting the UITableViewCell a UIButton belongs to like this:
-(void)buttonHandler:(UIButton *)button {
OrderCell *cell = [[button superview] superv
A better solution is to add a category for UIView(SuperView), and calling it by:
UITableViewCell *cell = [button findSuperViewWithClass:[UITableViewCell class]]
This way, your code works for all future and past iOS versions
@interface UIView (SuperView)
- (UIView *)findSuperViewWithClass:(Class)superViewClass;
@end
@implementation UIView (SuperView)
- (UIView *)findSuperViewWithClass:(Class)superViewClass {
UIView *superView = self.superview;
UIView *foundSuperView = nil;
while (nil != superView && nil == foundSuperView) {
if ([superView isKindOfClass:superViewClass]) {
foundSuperView = superView;
} else {
superView = superView.superview;
}
}
return foundSuperView;
}
@end