Coder Social home page Coder Social logo

Comments (3)

paulwalton avatar paulwalton commented on June 11, 2024

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.

from bbutton.

rickygu avatar rickygu commented on June 11, 2024

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

from bbutton.

chriswill0w avatar chriswill0w commented on June 11, 2024

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".

from bbutton.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.