BButton icon indicating copy to clipboard operation
BButton copied to clipboard

Unable to set button type via Interface Builder

Open TomasLinhart opened this issue 11 years ago • 3 comments

I didn't figure out how I can set button type via Interface Builder, maybe it is not even possible, I don't know, but it should be mentioned.

TomasLinhart avatar Apr 27 '13 01:04 TomasLinhart

Hi, I think this may help, see this commit of the read me : https://github.com/aw-emberex/BButton/blob/a43e61ce8edd8e50599c86837bf0bd38ba8b8379/README.md

Scroll to the section on IB.

paulwalton avatar Apr 30 '13 16:04 paulwalton

Paul, your link was helpful. I got the color working now, but how do you set the icon via interface builder?

rickygu avatar May 10 '13 04:05 rickygu

e.g. by creating a category for bbutton

.h file: @property (nonatomic) NSInteger faIcon;

.m file:

  • (NSInteger)faIcon { return 0; }
  • (void)setFaIcon:(NSInteger)faIcon { if (self.titleLabel.text == nil || [self.titleLabel.text isEqualToString:@""]) { [self setTitle:@" " forState:UIControlStateNormal]; [self addAwesomeIcon:faIcon beforeTitle:YES]; NSMutableString *str = [self.titleLabel.text mutableCopy]; CFStringTrimWhitespace((__bridge CFMutableStringRef)str); self.titleLabel.text = str; } else { [self addAwesomeIcon:faIcon beforeTitle:YES]; } }

and then you can set the Icon in the same way as the color via property key "faIcon".

chriswill0w avatar Jun 14 '13 11:06 chriswill0w