Skip to content

ZOYOOPlus/UIView-TapAction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UIView-Tap

给UIView添加点击事件

给UIView添加一个点击事件的扩展,说明一点在这个分类中如果想添加点击事件分类里面强制userInteractionEnabled = YES 使用到的技术,动态添加属性.getobjc_getAssociatedObject,setobjc_setAssociatedObject方法. 使用方法:

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(150, 400, 100, 100)];
    label.text = @"这是label,点击这里...";
    [label addTapBlock:^(UILabel* obj) {
        NSLog(@"label:\n%@",obj.text);
    }];
    [self.view addSubview:label];

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published