ios - Reuse UIButton style -
i've got couple of uibuttons same style, have different colors , have different widths. however, hate make seperate class new button needs different color, thought there must way style button , take, instance, color , height property. after image work importing uitableview's datasource/delegate.
so more concrete question: there way make class uibutton takes parameters such width , height, , possible declare kind of class uibutton?
that's no problem @ all. create category or subclass of uibutton. define custom init method - (instancetype)initwithcolor:(uicolor *)color size:(cgsize)size. in init method call self = [super initwithframe:cgrectzero] , set properties on self.
Comments
Post a Comment