如何在宏
中添加以下条件if(![NSStringFromClass([[self superview] class])isEqualToString:@“_ UIModalItemAlertContentView”])
我想仅在tableView类别的superClass不是alertView
时添加这两个方法#if ([NSStringFromClass([[self superview] class]) isEqualToString:@"_UIModalItemAlertContentView"])
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([self.customDelegate respondsToSelector:@selector(tableView:touchBegan:withEvent:)]) {
[self.customDelegate tableView:self touchBegan:touches withEvent:event];
}
[super touchesBegan:touches withEvent:event];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([self.customDelegate respondsToSelector:@selector(tableView:touchEnded:withEvent:)]) {
[self.customDelegate tableView:self touchEnded:touches withEvent:event];
}
}
#endif
答案 0 :(得分:0)
#define YourMacroName(_view_) ([NSStringFromClass([[_view_ superview] class]) isEqualToString:@"_UIModalItemAlertContentView"])
if(YourMacroName){
//do something
}
这是你想要的吗?