类方法创建button

    xiaoxiao2022-06-29  45

    + (UIButton *)creatButonWithType:(UIButtonType )type

                               Frame:(CGRect )frame

                               title:(NSString *)title

                          titleColor:(UIColor *)titleColor

                               image:(UIImage *)image font:(NSInteger )font {

        

        UIButton *button = [UIButton buttonWithType:type];

        button.frame = frame;

        [button setTitle:title forState:UIControlStateNormal];

        [button setTitleColor:titleColor forState:UIControlStateNormal];

        [button setImage:image forState:UIControlStateNormal];

        

        button.titleLabel.font = [UIFont systemFontOfSize:font];

        

        return button;

    }

    转载请注明原文地址: https://ju.6miu.com/read-1125252.html

    最新回复(0)