Skip to content

Commit

Permalink
Use image instead of image name to allow for stretchable images.
Browse files Browse the repository at this point in the history
  • Loading branch information
bentford committed Dec 10, 2013
1 parent a6c5c5e commit 904a7a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion EasyLayoutLibrary/ButtonMaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
+ (UIButton *)outerButtonWithNormalImageName:(NSString *)normalImageName selectedImageName:(NSString *)selectedImageName transparentOuterArea:(CGSize)outerArea;
+ (UIButton *)plainButtonWithNormalImageName:(NSString *)normalImageName selectedImageName:(NSString *)selectedImageName;
+ (UIButton *)plainButtonWithNormalImage:(UIImage *)normalImage selectedImage:(UIImage *)selectedImage;
+ (UIButton *)textButtonWithText:(NSString *)text font:(UIFont *)font color:(UIColor *)color normalImageName:(NSString *)normalImageName selectedImageName:(NSString *)selectedImageName;
+ (UIButton *)textButtonWithText:(NSString *)text font:(UIFont *)font color:(UIColor *)color
normalImage:(UIImage *)normalImage selectedImage:(UIImage *)selectedImage;

+ (void)setText:(NSString *)text forButton:(UIButton *)button maxSize:(CGSize)maxSize;
+ (void)setText:(NSString *)text forButton:(UIButton *)button maxWidth:(CGFloat)maxWidth;
Expand Down
9 changes: 3 additions & 6 deletions EasyLayoutLibrary/ButtonMaker.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ + (UIButton *)genericButtonWithTitle:(NSString *)title target:(id)target action:
{
UIButton *newButton = [ButtonMaker textButtonWithText:title
font:[UIFont systemFontOfSize:25.0f] color:[UIColor colorWithRed:27.0f/255.0f green:119.0f/255.0f blue:255.0f/255.0f alpha:1.0f]
normalImageName:nil selectedImageName:nil];
normalImage:nil selectedImage:nil];

[newButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];

Expand All @@ -33,12 +33,9 @@ + (UIButton *)plainButtonWithNormalImage:(UIImage *)normalImage selectedImage:(U
return newButton;
}

+ (UIButton *)textButtonWithText:(NSString *)text font:(UIFont *)font color:(UIColor *)color normalImageName:(NSString *)normalImageName selectedImageName:(NSString *)selectedImageName
+ (UIButton *)textButtonWithText:(NSString *)text font:(UIFont *)font color:(UIColor *)color
normalImage:(UIImage *)normalImage selectedImage:(UIImage *)selectedImage
{
UIImage *normalImage = [UIImage imageNamed:normalImageName];
UIImage *selectedImage = [UIImage imageNamed:selectedImageName];


UIButton *newButton = [UIButton buttonWithType:UIButtonTypeCustom];

[newButton setTitleColor:color forState:UIControlStateNormal];
Expand Down

0 comments on commit 904a7a2

Please sign in to comment.