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.xcodeproj/project.pbxproj | 26 +++++++++++++++----- 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 11 files changed, 151 insertions(+), 64 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 diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index 0755bda..7add9f1 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -26,7 +26,10 @@ 77C67EDF182827DB00427098 /* reveal-icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EDD182827DB00427098 /* reveal-icon@2x.png */; }; 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE11828288C00427098 /* RevealPanelViewController.m */; }; 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE41828342000427098 /* NSURL+PathParameters.m */; }; - 77C67EE81828379700427098 /* Colors.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* Colors.m */; }; + 77C67EE81828379700427098 /* ColorsAndButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* ColorsAndButtons.m */; }; + 77C67EEA18283C8D00427098 /* buttons.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EE918283C8D00427098 /* buttons.png */; }; + 77C67EEC18283F2D00427098 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77C67EEB18283F2D00427098 /* QuartzCore.framework */; }; + 77C67EF21828442C00427098 /* UIImage+Crop.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EF11828442C00427098 /* UIImage+Crop.m */; }; 77D163C2181F048F00401EF0 /* MessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 77D163C1181F048F00401EF0 /* MessageCell.m */; }; /* End PBXBuildFile section */ @@ -67,8 +70,12 @@ 77C67EE11828288C00427098 /* RevealPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RevealPanelViewController.m; sourceTree = ""; }; 77C67EE31828342000427098 /* NSURL+PathParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+PathParameters.h"; sourceTree = ""; }; 77C67EE41828342000427098 /* NSURL+PathParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PathParameters.m"; sourceTree = ""; }; - 77C67EE61828379700427098 /* Colors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Colors.h; sourceTree = ""; }; - 77C67EE71828379700427098 /* Colors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Colors.m; sourceTree = ""; }; + 77C67EE61828379700427098 /* ColorsAndButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorsAndButtons.h; sourceTree = ""; }; + 77C67EE71828379700427098 /* ColorsAndButtons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorsAndButtons.m; sourceTree = ""; }; + 77C67EE918283C8D00427098 /* buttons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttons.png; sourceTree = ""; }; + 77C67EEB18283F2D00427098 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 77C67EF01828442C00427098 /* UIImage+Crop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Crop.h"; sourceTree = ""; }; + 77C67EF11828442C00427098 /* UIImage+Crop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Crop.m"; sourceTree = ""; }; 77D163C0181F048F00401EF0 /* MessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = ""; }; 77D163C1181F048F00401EF0 /* MessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = ""; }; AD52EBAFFD6B4395B342F246 /* Pods-Juick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.xcconfig"; path = "Pods/Pods-Juick.xcconfig"; sourceTree = ""; }; @@ -80,6 +87,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 77C67EEC18283F2D00427098 /* QuartzCore.framework in Frameworks */, 77317BAE181BBE8500D60005 /* CoreGraphics.framework in Frameworks */, 77317BB0181BBE8500D60005 /* UIKit.framework in Frameworks */, 77317BAC181BBE8500D60005 /* Foundation.framework in Frameworks */, @@ -123,6 +131,7 @@ 77317BAA181BBE8500D60005 /* Frameworks */ = { isa = PBXGroup; children = ( + 77C67EEB18283F2D00427098 /* QuartzCore.framework */, 77317BAB181BBE8500D60005 /* Foundation.framework */, 77317BAD181BBE8500D60005 /* CoreGraphics.framework */, 77317BAF181BBE8500D60005 /* UIKit.framework */, @@ -135,6 +144,7 @@ 77317BB1181BBE8500D60005 /* Juick */ = { isa = PBXGroup; children = ( + 77C67EE918283C8D00427098 /* buttons.png */, 77C67EE31828342000427098 /* NSURL+PathParameters.h */, 77C67EE41828342000427098 /* NSURL+PathParameters.m */, 77C67EDC182827DB00427098 /* reveal-icon.png */, @@ -151,8 +161,10 @@ 77A09549181F1F25002BDECD /* Message.m */, 77C67EE01828288C00427098 /* RevealPanelViewController.h */, 77C67EE11828288C00427098 /* RevealPanelViewController.m */, - 77C67EE61828379700427098 /* Colors.h */, - 77C67EE71828379700427098 /* Colors.m */, + 77C67EE61828379700427098 /* ColorsAndButtons.h */, + 77C67EE71828379700427098 /* ColorsAndButtons.m */, + 77C67EF01828442C00427098 /* UIImage+Crop.h */, + 77C67EF11828442C00427098 /* UIImage+Crop.m */, ); path = Juick; sourceTree = ""; @@ -266,6 +278,7 @@ files = ( 77C67EDF182827DB00427098 /* reveal-icon@2x.png in Resources */, 77317BC7181BBE8500D60005 /* Images.xcassets in Resources */, + 77C67EEA18283C8D00427098 /* buttons.png in Resources */, 77317BB6181BBE8500D60005 /* InfoPlist.strings in Resources */, 77C67EDE182827DB00427098 /* reveal-icon.png in Resources */, ); @@ -319,12 +332,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 77C67EF21828442C00427098 /* UIImage+Crop.m in Sources */, 77D163C2181F048F00401EF0 /* MessageCell.m in Sources */, 77317BBC181BBE8500D60005 /* AppDelegate.m in Sources */, 77A0954A181F1F25002BDECD /* Message.m in Sources */, 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */, 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */, - 77C67EE81828379700427098 /* Colors.m in Sources */, + 77C67EE81828379700427098 /* ColorsAndButtons.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, 77317BB8181BBE8500D60005 /* main.m in Sources */, ); 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