From a795a089148f73389f1e35430ed94a9aec9156e7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Nov 2013 03:23:31 +0400 Subject: colors and buttons --- Juick/AppDelegate.m | 8 +++--- Juick/Colors.h | 18 -------------- Juick/Colors.m | 29 ---------------------- Juick/ColorsAndButtons.h | 20 +++++++++++++++ Juick/ColorsAndButtons.m | 50 ++++++++++++++++++++++++++++++++++++++ Juick/MessagesViewController.m | 6 ++--- Juick/RevealPanelViewController.m | 15 +++++++++--- Juick/UIImage+Crop.h | 15 ++++++++++++ Juick/UIImage+Crop.m | 28 +++++++++++++++++++++ Juick/buttons.png | Bin 0 -> 2392 bytes 10 files changed, 131 insertions(+), 58 deletions(-) delete mode 100644 Juick/Colors.h delete mode 100644 Juick/Colors.m create mode 100644 Juick/ColorsAndButtons.h create mode 100644 Juick/ColorsAndButtons.m create mode 100644 Juick/UIImage+Crop.h create mode 100644 Juick/UIImage+Crop.m create mode 100644 Juick/buttons.png (limited to 'Juick') diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index aa00698..f59ff02 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -11,16 +11,16 @@ #import "RevealPanelViewController.h" #import "SWRevealViewController.h" -#import "Colors.h" +#import "ColorsAndButtons.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // style the navigation bar - [[UINavigationBar appearance] setBarTintColor:[Colors navbarBackground]]; - [[UINavigationBar appearance] setTintColor:[Colors navbarFont]]; - [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [Colors navbarFont]}]; + [[UINavigationBar appearance] setBarTintColor:[ColorsAndButtons navbarBackground]]; + [[UINavigationBar appearance] setTintColor:[ColorsAndButtons navbarFont]]; + [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorsAndButtons navbarFont]}]; // make the status bar white [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; diff --git a/Juick/Colors.h b/Juick/Colors.h deleted file mode 100644 index bd9d260..0000000 --- a/Juick/Colors.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Colors.h -// Juick -// -// Created by Vitaly Takmazov on 05.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import - -@interface Colors : NSObject - -+(UIColor *) navbarBackground; -+(UIColor *) mainBackground; -+(UIColor *) navbarFont; -+(UIColor *) linkColor; - -@end diff --git a/Juick/Colors.m b/Juick/Colors.m deleted file mode 100644 index 1a64e3d..0000000 --- a/Juick/Colors.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// Colors.m -// Juick -// -// Created by Vitaly Takmazov on 05.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import "Colors.h" - -@implementation Colors - -+ (UIColor *) mainBackground { - return [UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]; -} - -+ (UIColor *) linkColor { - return [UIColor colorWithRed:0/255.0f green:102/255.0f blue:153/255.0f alpha:1.0f]; -} - -+ (UIColor *) navbarBackground { - return [UIColor colorWithRed:44/255.0f green:44/255.0f blue:44/255.0f alpha:1]; -} - -+ (UIColor *) navbarFont { - return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]; -} - -@end diff --git a/Juick/ColorsAndButtons.h b/Juick/ColorsAndButtons.h new file mode 100644 index 0000000..260bff1 --- /dev/null +++ b/Juick/ColorsAndButtons.h @@ -0,0 +1,20 @@ +// +// Colors.h +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface ColorsAndButtons : NSObject + ++(UIColor *) navbarBackground; ++(UIColor *) mainBackground; ++(UIColor *) navbarFont; ++(UIColor *) linkColor; ++(UIImage *) homeImage; ++(UIImage *) discoverImage; ++(UIImage *) logo; +@end diff --git a/Juick/ColorsAndButtons.m b/Juick/ColorsAndButtons.m new file mode 100644 index 0000000..c99707d --- /dev/null +++ b/Juick/ColorsAndButtons.m @@ -0,0 +1,50 @@ +// +// Colors.m +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "ColorsAndButtons.h" +#import "UIImage+Crop.h" + +UIImage *buttons; + +@implementation ColorsAndButtons + ++ (void) initialize +{ + [super initialize]; + buttons = [UIImage imageNamed:@"buttons.png"]; +} + + ++ (UIColor *) mainBackground { + return [UIColor colorWithRed:238/255.0f green:238/255.0f blue:229/255.0f alpha:1.0f]; +} + ++ (UIColor *) linkColor { + return [UIColor colorWithRed:0/255.0f green:102/255.0f blue:153/255.0f alpha:1.0f]; +} + ++ (UIColor *) navbarBackground { + return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1]; +} + ++ (UIColor *) navbarFont { + return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1]; +} + ++(UIImage *) homeImage { + return [buttons crop:CGRectMake(142, 0, 32, 32)]; +} ++ (UIImage *) discoverImage { + return [buttons crop:CGRectMake(174, 0, 32, 32)]; +} + ++ (UIImage *) logo { + return [buttons crop:CGRectMake(0, 0, 109, 32)]; +} + +@end diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m index 72cd0be..ac6f99d 100644 --- a/Juick/MessagesViewController.m +++ b/Juick/MessagesViewController.m @@ -13,7 +13,7 @@ #import "MessageCell.h" #import "Message.h" -#import "Colors.h" +#import "ColorsAndButtons.h" #import "NSURL+PathParameters.h" @@ -93,7 +93,7 @@ static NSString *CellIdentifier = @"MessageCell"; [super viewDidLoad]; self.dataLoading = NO; self.title = @"Discover"; - [self.view setBackgroundColor:[Colors mainBackground]]; + [self.view setBackgroundColor:[ColorsAndButtons mainBackground]]; SWRevealViewController *revealController = [self revealViewController]; [self.navigationController.navigationBar addGestureRecognizer:revealController.panGestureRecognizer]; UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"] @@ -155,7 +155,7 @@ static NSString *CellIdentifier = @"MessageCell"; Message *msg = [_messages objectAtIndex:indexPath.row]; [cell.avatar setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%@.png", msg.userID]]]]]; cell.titleLabel.text = msg.user; - cell.titleLabel.textColor = [Colors linkColor]; + cell.titleLabel.textColor = [ColorsAndButtons linkColor]; cell.bodyLabel.text = msg.text; [cell setBackgroundColor:[UIColor whiteColor]]; [cell setNeedsUpdateConstraints]; diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m index 67f1a08..7053832 100644 --- a/Juick/RevealPanelViewController.m +++ b/Juick/RevealPanelViewController.m @@ -8,7 +8,7 @@ #import "RevealPanelViewController.h" -#import "Colors.h" +#import "ColorsAndButtons.h" @interface RevealPanelViewController () @@ -28,8 +28,11 @@ - (void)viewDidLoad { [super viewDidLoad]; - self.title = @"Juick"; - [self.view setBackgroundColor:[Colors mainBackground]]; + [self.navigationController.navigationBar.topItem + setTitleView:[[UIImageView alloc] initWithImage:[ColorsAndButtons logo]]]; + [self.view setBackgroundColor:[ColorsAndButtons navbarBackground]]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + self.tableView.separatorColor =[UIColor blackColor]; } - (void)didReceiveMemoryWarning @@ -53,14 +56,18 @@ NSInteger row = indexPath.row; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; - cell.textLabel.textColor = [Colors linkColor]; + [cell setBackgroundColor:[ColorsAndButtons navbarBackground]]; + cell.textLabel.textColor = [ColorsAndButtons navbarFont]; } if (row == 0) { cell.textLabel.text = @"My feed"; + [cell.imageView setImage:[ColorsAndButtons homeImage]]; + } else if (row == 1) { cell.textLabel.text = @"Popular"; } else if (row == 2) { cell.textLabel.text = @"Discover"; + [cell.imageView setImage:[ColorsAndButtons discoverImage]]; } else if (row == 3) { cell.textLabel.text = @"Images"; } diff --git a/Juick/UIImage+Crop.h b/Juick/UIImage+Crop.h new file mode 100644 index 0000000..4eeaed2 --- /dev/null +++ b/Juick/UIImage+Crop.h @@ -0,0 +1,15 @@ +// +// UIImage+Crop.h +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import + +@interface UIImage (Crop) + +- (UIImage *)crop:(CGRect)rect; + +@end diff --git a/Juick/UIImage+Crop.m b/Juick/UIImage+Crop.m new file mode 100644 index 0000000..d51b94e --- /dev/null +++ b/Juick/UIImage+Crop.m @@ -0,0 +1,28 @@ +// +// UIImage+Crop.m +// Juick +// +// Created by Vitaly Takmazov on 05.11.13. +// Copyright (c) 2013 com.juick. All rights reserved. +// + +#import "UIImage+Crop.h" + +@implementation UIImage (Crop) + +- (UIImage *)crop:(CGRect)rect { + + rect = CGRectMake(rect.origin.x*self.scale, + rect.origin.y*self.scale, + rect.size.width*self.scale, + rect.size.height*self.scale); + + CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], rect); + UIImage *result = [UIImage imageWithCGImage:imageRef + scale:self.scale + orientation:self.imageOrientation]; + CGImageRelease(imageRef); + return result; +} + +@end diff --git a/Juick/buttons.png b/Juick/buttons.png new file mode 100644 index 0000000..14879e4 Binary files /dev/null and b/Juick/buttons.png differ -- cgit v1.2.3