# HG changeset patch # User koda # Date 1329589756 -3600 # Node ID 76e96101a84f2265f2bfadf756def2fbee9c0951 # Parent 01853929804253acc7f04bd3ff27e42ad8951bd1 prepare a styled button diff -r 018539298042 -r 76e96101a84f project_files/HedgewarsMobile/Classes/ExtraCategories.h --- a/project_files/HedgewarsMobile/Classes/ExtraCategories.h Sat Feb 18 19:07:19 2012 +0100 +++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.h Sat Feb 18 19:29:16 2012 +0100 @@ -48,12 +48,19 @@ @end +@interface UIButton (quickStyle) + +-(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title; + +@end + + @interface UILabel (quickStyle) --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title; --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth; --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth - withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor; +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title; +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth; +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth + withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor; @end diff -r 018539298042 -r 76e96101a84f project_files/HedgewarsMobile/Classes/ExtraCategories.m --- a/project_files/HedgewarsMobile/Classes/ExtraCategories.m Sat Feb 18 19:07:19 2012 +0100 +++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.m Sat Feb 18 19:29:16 2012 +0100 @@ -96,9 +96,31 @@ #pragma mark - +@implementation UIButton (quickStyle) + +-(id) initWithFrame:(CGRect) frame andTitle:(NSString *)title { + [self initWithFrame:frame]; + [self setTitle:title forState:UIControlStateNormal]; + [self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [self setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; + self.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; + self.backgroundColor = [UIColor blackColorTransparent]; + + [self.layer setBorderWidth:1]; + [self.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; + [self.layer setCornerRadius:9.0f]; + [self.layer setMasksToBounds:YES]; + + return self; +} + +@end + + +#pragma mark - @implementation UILabel (quickStyle) --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title { +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title { return [self initWithFrame:frame andTitle:title withBorderWidth:1.5f @@ -106,7 +128,7 @@ withBackgroundColor:[UIColor darkBlueColor]]; } --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth { +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth { return [self initWithFrame:frame andTitle:title withBorderWidth:borderWidth @@ -114,8 +136,8 @@ withBackgroundColor:[UIColor darkBlueColorTransparent]]; } --(UILabel *)initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth - withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor{ +-(id) initWithFrame:(CGRect)frame andTitle:(NSString *)title withBorderWidth:(CGFloat) borderWidth + withBorderColor:(UIColor *)borderColor withBackgroundColor:(UIColor *)backColor { UILabel *theLabel = [self initWithFrame:frame]; theLabel.backgroundColor = backColor; diff -r 018539298042 -r 76e96101a84f project_files/HedgewarsMobile/Classes/StatsPageViewController.m --- a/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Sat Feb 18 19:07:19 2012 +0100 +++ b/project_files/HedgewarsMobile/Classes/StatsPageViewController.m Sat Feb 18 19:29:16 2012 +0100 @@ -20,7 +20,6 @@ #import "StatsPageViewController.h" -#import @implementation StatsPageViewController @synthesize statsArray; @@ -148,18 +147,9 @@ UIView *footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width * 70 / 100, aTableView.rowHeight)]; footer.autoresizingMask = UIViewAutoresizingFlexibleWidth; - UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.width * 70 / 100, aTableView.rowHeight)]; + UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 17, self.view.frame.size.width * 70 / 100, aTableView.rowHeight) + andTitle:NSLocalizedString(@"Done",@"")]; button.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; - [button setTitle:NSLocalizedString(@"Done",@"") forState:UIControlStateNormal]; - [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted]; - - button.titleLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; - button.backgroundColor = [UIColor blackColorTransparent]; - [button.layer setBorderWidth:1]; - [button.layer setBorderColor:[[UIColor darkYellowColor] CGColor]]; - [button.layer setCornerRadius:9.0f]; - [button.layer setMasksToBounds:YES]; [button addTarget:self action:@selector(dismissView) forControlEvents:UIControlEventTouchUpInside]; [footer addSubview:button]; [button release];