您的位置:首页 > 移动开发 > IOS开发

IOS中自定义返回按钮点击事件响应视图过大解决办法

2017-05-17 09:18 507 查看
#import <UIKit/UIKit.h>

@interface UINavigationBar (Event)

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent
*)event;

@end

#import "UINavigationBar+Event.h"

@implementation UINavigationBar (Event)

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent
*)event {

   
if ([self
pointInside:point
withEvent:event]) {

       
self.userInteractionEnabled =
YES;

    } else {

       
self.userInteractionEnabled =
NO;

    }

   
return [super
hitTest:point
withEvent:event];

}

@end

在自定义的UINavigationController中引入头文件 #import "UINavigationBar+Event.h"即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: