SmallButton.m 689 B

1234567891011121314151617181920212223242526272829
  1. //
  2. // SmallButton.m
  3. //
  4. // Created by stcui on 15/7/14.
  5. // Copyright © 2015年 Tencent. All rights reserved.
  6. //
  7. #import "SmallButton.h"
  8. @implementation SmallButton
  9. - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
  10. {
  11. if (!self.enabled || self.hidden) return [super pointInside:point withEvent:event];
  12. CGRect area = self.frame;
  13. area.origin = CGPointZero;
  14. if (CGRectGetWidth(area) < 44) {
  15. area.origin.x = CGRectGetMidX(area) - 22;
  16. area.size.width = 44;
  17. }
  18. if (CGRectGetHeight(area) < 44) {
  19. area.origin.y = CGRectGetMidY(area) - 22;
  20. area.size.height = 44;
  21. }
  22. return CGRectContainsPoint(area, point);
  23. }
  24. @end