summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/AppDelegate.m8
-rw-r--r--Juick/Colors.m29
-rw-r--r--Juick/ColorsAndButtons.h (renamed from Juick/Colors.h)6
-rw-r--r--Juick/ColorsAndButtons.m50
-rw-r--r--Juick/MessagesViewController.m6
-rw-r--r--Juick/RevealPanelViewController.m15
-rw-r--r--Juick/UIImage+Crop.h15
-rw-r--r--Juick/UIImage+Crop.m28
-rw-r--r--Juick/buttons.pngbin0 -> 2392 bytes
9 files changed, 115 insertions, 42 deletions
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.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/Colors.h b/Juick/ColorsAndButtons.h
index bd9d260..260bff1 100644
--- a/Juick/Colors.h
+++ b/Juick/ColorsAndButtons.h
@@ -8,11 +8,13 @@
#import <Foundation/Foundation.h>
-@interface Colors : NSObject
+@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 <UIKit/UIKit.h>
+
+@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
--- /dev/null
+++ b/Juick/buttons.png
Binary files differ