美文网首页
给UIButton添加一个枚举类型,快速切换图片和标题的上下左右

给UIButton添加一个枚举类型,快速切换图片和标题的上下左右

作者: EdwardSY | 来源:发表于2018-09-29 14:41 被阅读0次

    pod 'EDWButtonImageTitleChange'

    typedef NS_ENUM (NSInteger,EDWButttonType) {
        EDWButttonTypeImageUp,
        EDWButttonTypeImageLeft,
        EDWButttonTypeImageDown,
        EDWButttonTypeImageRight,
    } ;
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeSystem];
        [btn setBackgroundColor:[UIColor cyanColor]];
        [btn setTitle:@"title!!!!" forState:UIControlStateNormal];
        [btn setFrame:CGRectMake(0, 0, 250, 200)];
        [btn setCenter:self.view.center];
        [btn setImage:[UIImage imageNamed:@"pic"] forState:UIControlStateNormal];
        [self.view addSubview:btn];
        [btn changeWithType:EDWButttonTypeImageRight andInterval:10];
    
    EDWButttonTypeImageUp
    
    up.png
    EDWButttonTypeImageLeft
    
    left.png
    EDWButttonTypeImageDown
    
    down.png
    EDWButttonTypeImageRight
    
    right.png

    https://github.com/jinjinEdward/EDWButtonImageTitleChange

    相关文章

      网友评论

          本文标题:给UIButton添加一个枚举类型,快速切换图片和标题的上下左右

          本文链接:https://www.haomeiwen.com/subject/phzvoftx.html