summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Juick.xcodeproj/project.pbxproj24
-rw-r--r--Juick/AppDelegate.m10
-rw-r--r--Juick/ColorScheme.h (renamed from Juick/ColorsAndButtons.h)5
-rw-r--r--Juick/ColorScheme.m (renamed from Juick/ColorsAndButtons.m)22
-rw-r--r--Juick/Juick-Info.plist16
-rw-r--r--Juick/Juick-Prefix.pch1
-rw-r--r--Juick/Juick.ipabin0 -> 1052917 bytes
-rw-r--r--Juick/MessageCell.m28
-rw-r--r--Juick/MessagesViewController.m32
-rw-r--r--Juick/NavCell.h14
-rw-r--r--Juick/NavCell.m53
-rw-r--r--Juick/RevealPanelViewController.m53
-rw-r--r--Juick/UIImage+Crop.h15
-rw-r--r--Juick/UIImage+Crop.m28
-rw-r--r--Podfile2
-rw-r--r--Podfile.lock8
16 files changed, 168 insertions, 143 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index e1e4b3a..beaf931 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
023DFC884FC1455E9522E9BF /* libPods-Juick.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1A04338EB0146778B4503DC /* libPods-Juick.a */; };
+ 771E4AD618606AA400EBACC8 /* NavCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 771E4AD518606AA400EBACC8 /* NavCell.m */; };
77317BAC181BBE8500D60005 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAB181BBE8500D60005 /* Foundation.framework */; };
77317BAE181BBE8500D60005 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAD181BBE8500D60005 /* CoreGraphics.framework */; };
77317BB0181BBE8500D60005 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAF181BBE8500D60005 /* UIKit.framework */; };
@@ -33,10 +34,9 @@
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 /* ColorsAndButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* ColorsAndButtons.m */; };
+ 77C67EE81828379700427098 /* ColorScheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C67EE71828379700427098 /* ColorScheme.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 */
@@ -51,6 +51,8 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 771E4AD418606AA400EBACC8 /* NavCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavCell.h; sourceTree = "<group>"; };
+ 771E4AD518606AA400EBACC8 /* NavCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavCell.m; sourceTree = "<group>"; };
77317BA8181BBE8500D60005 /* Juick.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Juick.app; sourceTree = BUILT_PRODUCTS_DIR; };
77317BAB181BBE8500D60005 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
77317BAD181BBE8500D60005 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -85,12 +87,10 @@
77C67EE11828288C00427098 /* RevealPanelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RevealPanelViewController.m; sourceTree = "<group>"; };
77C67EE31828342000427098 /* NSURL+PathParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+PathParameters.h"; sourceTree = "<group>"; };
77C67EE41828342000427098 /* NSURL+PathParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+PathParameters.m"; sourceTree = "<group>"; };
- 77C67EE61828379700427098 /* ColorsAndButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorsAndButtons.h; sourceTree = "<group>"; };
- 77C67EE71828379700427098 /* ColorsAndButtons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorsAndButtons.m; sourceTree = "<group>"; };
+ 77C67EE61828379700427098 /* ColorScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorScheme.h; sourceTree = "<group>"; };
+ 77C67EE71828379700427098 /* ColorScheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorScheme.m; sourceTree = "<group>"; };
77C67EE918283C8D00427098 /* buttons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = buttons.png; sourceTree = "<group>"; };
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 = "<group>"; };
- 77C67EF11828442C00427098 /* UIImage+Crop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Crop.m"; sourceTree = "<group>"; };
77D163C0181F048F00401EF0 /* MessageCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageCell.h; sourceTree = "<group>"; };
77D163C1181F048F00401EF0 /* MessageCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageCell.m; sourceTree = "<group>"; };
AD52EBAFFD6B4395B342F246 /* Pods-Juick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.xcconfig"; path = "Pods/Pods-Juick.xcconfig"; sourceTree = "<group>"; };
@@ -185,12 +185,12 @@
77A09549181F1F25002BDECD /* Message.m */,
77C67EE01828288C00427098 /* RevealPanelViewController.h */,
77C67EE11828288C00427098 /* RevealPanelViewController.m */,
- 77C67EE61828379700427098 /* ColorsAndButtons.h */,
- 77C67EE71828379700427098 /* ColorsAndButtons.m */,
- 77C67EF01828442C00427098 /* UIImage+Crop.h */,
- 77C67EF11828442C00427098 /* UIImage+Crop.m */,
+ 77C67EE61828379700427098 /* ColorScheme.h */,
+ 77C67EE71828379700427098 /* ColorScheme.m */,
77975A1B182B6E9A00410C2B /* NewPostViewController.h */,
77975A1C182B6E9A00410C2B /* NewPostViewController.m */,
+ 771E4AD418606AA400EBACC8 /* NavCell.h */,
+ 771E4AD518606AA400EBACC8 /* NavCell.m */,
);
path = Juick;
sourceTree = "<group>";
@@ -364,14 +364,14 @@
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 */,
+ 771E4AD618606AA400EBACC8 /* NavCell.m in Sources */,
77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */,
77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */,
77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */,
- 77C67EE81828379700427098 /* ColorsAndButtons.m in Sources */,
+ 77C67EE81828379700427098 /* ColorScheme.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 a776b43..7ccaf13 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -11,7 +11,7 @@
#import "RevealPanelViewController.h"
#import "SWRevealViewController.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "Message.h"
@implementation AppDelegate
@@ -20,10 +20,10 @@
{
// style the navigation bar
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
- [[UINavigationBar appearance] setBarTintColor:[ColorsAndButtons navbarBackground]];
- }
- [[UINavigationBar appearance] setTintColor:[ColorsAndButtons navbarFont]];
- [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorsAndButtons navbarFont]}];
+ [[UINavigationBar appearance] setBarTintColor:[ColorScheme navbarBackground]];
+ [[UINavigationBar appearance] setTintColor:[ColorScheme navbarFont]];
+ [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme navbarFont]}];
+ }
// make the status bar white
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
diff --git a/Juick/ColorsAndButtons.h b/Juick/ColorScheme.h
index 260bff1..275962c 100644
--- a/Juick/ColorsAndButtons.h
+++ b/Juick/ColorScheme.h
@@ -8,13 +8,10 @@
#import <Foundation/Foundation.h>
-@interface ColorsAndButtons : NSObject
+@interface ColorScheme : NSObject
+(UIColor *) navbarBackground;
+(UIColor *) mainBackground;
+(UIColor *) navbarFont;
+(UIColor *) linkColor;
-+(UIImage *) homeImage;
-+(UIImage *) discoverImage;
-+(UIImage *) logo;
@end
diff --git a/Juick/ColorsAndButtons.m b/Juick/ColorScheme.m
index c99707d..257cc72 100644
--- a/Juick/ColorsAndButtons.m
+++ b/Juick/ColorScheme.m
@@ -6,17 +6,13 @@
// Copyright (c) 2013 com.juick. All rights reserved.
//
-#import "ColorsAndButtons.h"
-#import "UIImage+Crop.h"
+#import "ColorScheme.h"
-UIImage *buttons;
-
-@implementation ColorsAndButtons
+@implementation ColorScheme
+ (void) initialize
{
[super initialize];
- buttons = [UIImage imageNamed:@"buttons.png"];
}
@@ -29,22 +25,12 @@ UIImage *buttons;
}
+ (UIColor *) navbarBackground {
- return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1];
+ return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1.0f];
}
+ (UIColor *) navbarFont {
- return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1];
+ return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1.0f];
}
-+(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/Juick-Info.plist b/Juick/Juick-Info.plist
index 2f29b33..33830ba 100644
--- a/Juick/Juick-Info.plist
+++ b/Juick/Juick-Info.plist
@@ -17,15 +17,21 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0.1</string>
+ <string>1.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0.1</string>
+ <string>1.0.4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>NSHumanReadableCopyright</key>
+ <string></string>
+ <key>UIAppFonts</key>
+ <array>
+ <string>FontAwesome.ttf</string>
+ </array>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
@@ -48,12 +54,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
- <key>UIAppFonts</key>
- <array>
- <string>FontAwesome.ttf</string>
- </array>
- <key>NSHumanReadableCopyright</key>
- <string></string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
diff --git a/Juick/Juick-Prefix.pch b/Juick/Juick-Prefix.pch
index 1bd0628..ad49a41 100644
--- a/Juick/Juick-Prefix.pch
+++ b/Juick/Juick-Prefix.pch
@@ -16,4 +16,5 @@
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#define MAS_SHORTHAND
+ #import "Masonry.h"
#endif
diff --git a/Juick/Juick.ipa b/Juick/Juick.ipa
new file mode 100644
index 0000000..e3ffdbf
--- /dev/null
+++ b/Juick/Juick.ipa
Binary files differ
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m
index 3f06436..0dea69a 100644
--- a/Juick/MessageCell.m
+++ b/Juick/MessageCell.m
@@ -7,9 +7,8 @@
//
#import "MessageCell.h"
-#import "ColorsAndButtons.h"
-#import "Masonry.h"
-#import "JMImageCache.h"
+#import "ColorScheme.h"
+#import <SDWebImage/UIImageView+WebCache.h>
@interface MessageCell ()
@@ -23,7 +22,7 @@
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
- [self setBackgroundColor:[UIColor whiteColor]];
+ [self.contentView setBackgroundColor:[UIColor whiteColor]];
self.avatar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
[self.avatar setBackgroundColor:[UIColor clearColor]];
@@ -31,7 +30,7 @@
[self.titleLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[self.titleLabel setNumberOfLines:1];
[self.titleLabel setTextAlignment:NSTextAlignmentLeft];
- [self.titleLabel setTextColor:[ColorsAndButtons linkColor]];
+ [self.titleLabel setTextColor:[ColorScheme linkColor]];
[self.titleLabel setBackgroundColor:[UIColor clearColor]];
self.timestampLabel = [[UILabel alloc] initWithFrame:CGRectZero];
@@ -105,19 +104,16 @@
make.left.equalTo(self.avatar.right).with.offset(padding.left);
make.top.equalTo(self.titleLabel.bottom).with.offset(padding.top /2);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
- make.bottom.equalTo(self.bodyLabel.top).with.offset(-padding.bottom);
}];
[self.bodyLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.top.equalTo(self.timestampLabel.bottom).with.offset(padding.top);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
- make.bottom.equalTo(self.attach.top).with.offset(-padding.bottom);
}];
[self.attach makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).with.offset(padding.left);
- make.bottom.equalTo(self.summaryLabel.top).with.offset(-padding.bottom);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
make.top.equalTo(self.bodyLabel.bottom).with.offset(padding.top);
}];
@@ -147,7 +143,7 @@
- (void) bind:(Message *)msg {
[self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%d.png", [msg.userID intValue]]]];
-
+ __weak MessageCell *weakSelf = self;
self.titleLabel.text = msg.user;
self.timestampLabel.text = msg.timestamp;
if (msg.repliesCount > 0) {
@@ -165,10 +161,22 @@
[msg.text stringByDecodingHTMLEntities]];
}
if ([msg.attach length] > 0) {
- [self.attach setImageWithURL:[NSURL URLWithString:msg.attach] key:[NSString stringWithFormat:@"%d", [msg.MID intValue]] placeholder:[UIImage imageNamed:@"AttachPlaceholder.png"]];
+ [self.attach setImageWithURL:[NSURL URLWithString:msg.attach] placeholderImage:[UIImage imageNamed:@"AttachPlaceholder.png"] options:SDWebImageContinueInBackground
+ progress:^(NSUInteger receivedSize, long long expectedSize) {
+ // <#code#>
+ } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
+ [weakSelf setNeedsUpdateConstraints];
+ [weakSelf updateConstraintsIfNeeded];
+ [weakSelf.contentView setNeedsLayout];
+ [weakSelf.contentView layoutIfNeeded];
+ }];
} else {
self.attach.image = nil;
}
+ [weakSelf setNeedsUpdateConstraints];
+ [weakSelf updateConstraintsIfNeeded];
+ [weakSelf.contentView setNeedsLayout];
+ [weakSelf.contentView layoutIfNeeded];
}
- (void) attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 4361148..b77901b 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -12,7 +12,7 @@
#import "MessageCell.h"
#import "Message.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "NewPostViewController.h"
@@ -80,14 +80,20 @@ static NSString *CellIdentifier = @"MessageCell";
{
[super viewDidLoad];
self.dataLoading = NO;
- [self.view setBackgroundColor:[ColorsAndButtons mainBackground]];
+ [self.view setBackgroundColor:[ColorScheme mainBackground]];
self.messages = [NSMutableArray array];
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
[refresh addTarget:self action:@selector(refreshData:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refresh;
-
- //UINib *cellNib = [UINib nibWithNibName:@"MessageCell" bundle:nil];
- //[self.tableView registerNib:cellNib forCellReuseIdentifier:@"MessageCell"];
+ SWRevealViewController *revealController = [self revealViewController];
+ if (revealController) {
+ // TODO: add to thread view too
+ [self.view addGestureRecognizer:[revealController panGestureRecognizer]];
+ }
+ if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
+ self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground];
+ }
+
[self.tableView registerClass:[MessageCell class] forCellReuseIdentifier:CellIdentifier];
}
@@ -142,14 +148,10 @@ static NSString *CellIdentifier = @"MessageCell";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+ MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
[cell updateFonts];
Message *msg = [_messages objectAtIndex:indexPath.row];
[cell bind:msg];
- [cell setNeedsUpdateConstraints];
- [cell updateConstraintsIfNeeded];
- [cell.contentView setNeedsLayout];
- [cell.contentView layoutIfNeeded];
cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame);
[cell.contentView layoutIfNeeded];
@@ -166,12 +168,6 @@ static NSString *CellIdentifier = @"MessageCell";
[cell bind:msg];
- [cell setNeedsUpdateConstraints];
- [cell updateConstraintsIfNeeded];
-
- [cell.contentView setNeedsLayout];
- [cell.contentView layoutIfNeeded];
-
cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame);
[cell.contentView layoutIfNeeded];
@@ -182,9 +178,9 @@ static NSString *CellIdentifier = @"MessageCell";
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
- if (self.dataLoading) {
+ /* if (self.dataLoading) {
return [self tableView:tableView heightForRowAtIndexPath:indexPath];
- }
+ }*/
return 500.0f;
}
diff --git a/Juick/NavCell.h b/Juick/NavCell.h
new file mode 100644
index 0000000..50eec8d
--- /dev/null
+++ b/Juick/NavCell.h
@@ -0,0 +1,14 @@
+//
+// NavCell.h
+// Juick
+//
+// Created by Vitaly on 17.12.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface NavCell : UITableViewCell
+@property (strong, nonatomic) IBOutlet UILabel *iconLabel;
+@property (strong, nonatomic) IBOutlet UILabel *descriptionTextLabel;
+@end
diff --git a/Juick/NavCell.m b/Juick/NavCell.m
new file mode 100644
index 0000000..0b16e43
--- /dev/null
+++ b/Juick/NavCell.m
@@ -0,0 +1,53 @@
+//
+// NavCell.m
+// Juick
+//
+// Created by Vitaly on 17.12.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "NavCell.h"
+
+@interface NavCell ()
+
+@property (nonatomic, assign) BOOL didSetupConstraints;
+
+@end
+
+@implementation NavCell
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+ if (self) {
+ self.backgroundColor = [UIColor blackColor];
+ self.iconLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ self.descriptionTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ [self.contentView addSubview:self.iconLabel];
+ [self.contentView addSubview:self.descriptionTextLabel];
+ }
+ return self;
+}
+
+- (void)updateConstraints {
+ [super updateConstraints];
+
+ if (self.didSetupConstraints) return;
+ [self.iconLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.left.equalTo(self.contentView.left).with.offset(20.f);
+ make.top.equalTo(self.contentView.top).with.offset(10.f);
+ make.width.equalTo(@36);
+ make.height.equalTo(@36);
+
+ }];
+
+ [self.descriptionTextLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.left.equalTo(self.iconLabel.right).with.offset(10.f);
+ make.top.equalTo(self.contentView.top).with.offset(15.f);
+ make.right.equalTo(self.contentView.right).with.offset(-20.f);
+ }];
+
+ self.didSetupConstraints = YES;
+}
+
+@end
diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m
index ecac5df..a9c71e8 100644
--- a/Juick/RevealPanelViewController.m
+++ b/Juick/RevealPanelViewController.m
@@ -11,8 +11,13 @@
#import "RevealPanelViewController.h"
#import "MessagesViewController.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "NSURL+PathParameters.h"
+#import "NavCell.h"
+
+
+
+static NSString *CellIdentifier = @"NavCell";
@interface RevealPanelViewController ()
@@ -32,11 +37,15 @@
- (void)viewDidLoad
{
[super viewDidLoad];
- [self.navigationController.navigationBar.topItem
- setTitleView:[[UIImageView alloc] initWithImage:[ColorsAndButtons logo]]];
- [self.view setBackgroundColor:[ColorsAndButtons navbarBackground]];
+ self.title = @"Juick";
+
+ if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
+ self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground];
+ }
+ [self.view setBackgroundColor:[ColorScheme navbarBackground]];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.separatorColor =[UIColor blackColor];
+ [self.tableView registerClass:[NavCell class] forCellReuseIdentifier:CellIdentifier];
}
- (void)didReceiveMemoryWarning
@@ -55,30 +64,32 @@
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellIdentifier = @"MenuCell";
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSInteger row = indexPath.row;
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:cellIdentifier];
- [cell setBackgroundColor:[ColorsAndButtons navbarBackground]];
- cell.textLabel.font = [UIFont fontWithName:kFontAwesomeFamilyName size:20.f];
- cell.textLabel.textColor = [ColorsAndButtons navbarFont];
- cell.detailTextLabel.textColor = [ColorsAndButtons navbarFont];
- }
+ [cell.contentView setBackgroundColor:[ColorScheme navbarBackground]];
+ cell.iconLabel.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f];
+ cell.iconLabel.textColor = [ColorScheme navbarFont];
+ cell.iconLabel.backgroundColor = [ColorScheme navbarBackground];
+ cell.descriptionTextLabel.backgroundColor = [ColorScheme navbarBackground];
+ cell.descriptionTextLabel.textColor = [ColorScheme navbarFont];
if (row == 0) {
- cell.detailTextLabel.text = @"My feed";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconHome];
+ cell.descriptionTextLabel.text = @"My feed";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconHome];
} else if (row == 1) {
- cell.detailTextLabel.text = @"Popular";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconComments];
+ cell.descriptionTextLabel.text = @"Popular";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconComments];
} else if (row == 2) {
- cell.detailTextLabel.text = @"Discover";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch];
+ cell.descriptionTextLabel.text = @"Discover";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch];
} else if (row == 3) {
- cell.detailTextLabel.text = @"Images";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture];
+ cell.descriptionTextLabel.text = @"Images";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture];
}
+ [cell setNeedsUpdateConstraints];
+ [cell updateConstraintsIfNeeded];
+ [cell.contentView setNeedsLayout];
+ [cell.contentView layoutIfNeeded];
return cell;
}
diff --git a/Juick/UIImage+Crop.h b/Juick/UIImage+Crop.h
deleted file mode 100644
index 4eeaed2..0000000
--- a/Juick/UIImage+Crop.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// 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
deleted file mode 100644
index d51b94e..0000000
--- a/Juick/UIImage+Crop.m
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// 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/Podfile b/Podfile
index d364274..a4e5fa2 100644
--- a/Podfile
+++ b/Podfile
@@ -8,7 +8,7 @@ pod 'Masonry'
pod 'SWRevealViewController'
pod 'PDKeychainBindingsController'
pod 'RestKit'
-pod 'JMImageCache'
+pod 'SDWebImage'
pod 'FontAwesome+iOS'
end
diff --git a/Podfile.lock b/Podfile.lock
index 09f5a70..cebc103 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -3,7 +3,6 @@ PODS:
- FontAwesome+iOS (0.1.1)
- ISO8601DateFormatterValueTransformer (0.5.0):
- RKValueTransformers (~> 1.0.0)
- - JMImageCache (0.4.0)
- Masonry (0.2.4)
- MWFeedParser (0.0.1):
- MWFeedParser/Feed
@@ -34,6 +33,9 @@ PODS:
- RestKit/Support (0.21.0):
- TransitionKit (= 1.1.1)
- RKValueTransformers (1.0.1)
+ - SDWebImage (3.5.1):
+ - SDWebImage/Core
+ - SDWebImage/Core (3.5.1)
- SOCKit (1.1)
- SWRevealViewController (1.0.8)
- TransitionKit (1.1.1)
@@ -41,11 +43,11 @@ PODS:
DEPENDENCIES:
- FontAwesome+iOS
- - JMImageCache
- Masonry
- MWFeedParser
- PDKeychainBindingsController
- RestKit
+ - SDWebImage
- SWRevealViewController
- TTTAttributedLabel
@@ -53,12 +55,12 @@ SPEC CHECKSUMS:
AFNetworking: 61fdd49e2ffe6380378df37b3b6e70630bb9dd66
FontAwesome+iOS: 243c5309e90d5788909b0f859f75ecff4a20f88f
ISO8601DateFormatterValueTransformer: d0af1f50a9df42db72d7418db31938b8473e0af8
- JMImageCache: 4d764ca5819ce5b0b3bb1efb85c29977768c54bd
Masonry: 73df2f346bd1a0044dc9de969aa45aea2f8a9bd8
MWFeedParser: 2ca0852fac352f8333d5f46fdd4b583b921e0c4e
PDKeychainBindingsController: 463c207f8726e4aaec1ec20fd1876082ee86cb0a
RestKit: c11a30e7bc73513d9d2c2695672aba7697d24181
RKValueTransformers: 1562d458b9c9d59ce777bfc5982f2e1aef2e9182
+ SDWebImage: a408b548a634b792372e07e753fc1079aff5032a
SOCKit: 2f3bc4d07910de12dcc202815e07db68a3802581
SWRevealViewController: 5688d9d017e228c9edd92db359f670d8c47ab8e6
TransitionKit: d0e3344aac92991395d4c2e72d9c5a8ceeb12910