diff options
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/AppDelegate.h | 1 | ||||
-rw-r--r-- | Juick/Juick-Prefix.pch | 1 | ||||
-rw-r--r-- | Juick/NavCell.h | 16 | ||||
-rw-r--r-- | Juick/NavCell.m | 43 | ||||
-rw-r--r-- | Juick/RevealPanelViewController.h | 2 | ||||
-rw-r--r-- | Juick/RevealPanelViewController.m | 30 | ||||
-rw-r--r-- | Juick/TitleView.h | 19 | ||||
-rw-r--r-- | Juick/TitleView.m | 37 | ||||
-rw-r--r-- | Juick/UILabel+Utils.h | 15 | ||||
-rw-r--r-- | Juick/UILabel+Utils.m | 16 | ||||
-rw-r--r-- | Juick/Views/NavCell.h | 14 | ||||
-rw-r--r-- | Juick/Views/NavCell.m | 24 | ||||
-rw-r--r-- | Juick/Views/NavCell.xib | 51 |
13 files changed, 103 insertions, 166 deletions
diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h index 561f7ee..c0a7650 100644 --- a/Juick/AppDelegate.h +++ b/Juick/AppDelegate.h @@ -8,7 +8,6 @@ #import <UIKit/UIKit.h> #import "User.h" -#import "TitleView.h" @class SWRevealViewController; diff --git a/Juick/Juick-Prefix.pch b/Juick/Juick-Prefix.pch index a0abcee..bd31eac 100644 --- a/Juick/Juick-Prefix.pch +++ b/Juick/Juick-Prefix.pch @@ -18,7 +18,6 @@ #import <SDWebImage/UIImageView+WebCache.h> #import "NSString+HTML.h" #import "UIImage+Utils.h" - #import "UILabel+Utils.h" #import "NSDate+TimeAgo.h" #import "TTTAttributedLabel.h" #endif diff --git a/Juick/NavCell.h b/Juick/NavCell.h deleted file mode 100644 index e210636..0000000 --- a/Juick/NavCell.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// NavCell.h -// Juick -// -// Created by Vitaly on 17.12.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import <UIKit/UIKit.h> - -#import "UILabel+Utils.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 deleted file mode 100644 index 8cd460a..0000000 --- a/Juick/NavCell.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// 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.iconLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - self.descriptionTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - self.descriptionTextLabel.numberOfLines = 1; - self.descriptionTextLabel.textAlignment = NSTextAlignmentLeft; - [self.contentView addSubview:self.iconLabel]; - [self.contentView addSubview:self.descriptionTextLabel]; - } - return self; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - - CGRect iconRect = [UILabel sizeForLabel:self.iconLabel width:36.0f]; - self.iconLabel.frame = CGRectMake(10, 10, iconRect.size.width, iconRect.size.height); - float textHeight = [UILabel sizeForLabel:self.descriptionTextLabel width:self.contentView.bounds.size.width].size.height; - self.descriptionTextLabel.frame = CGRectMake(10 + self.iconLabel.frame.size.width + 10, 10 + (iconRect.size.height - textHeight) / 2, - self.contentView.bounds.size.width - self.iconLabel.frame.size.width - 10*3, textHeight); -} - -@end diff --git a/Juick/RevealPanelViewController.h b/Juick/RevealPanelViewController.h index 89f87e9..0300274 100644 --- a/Juick/RevealPanelViewController.h +++ b/Juick/RevealPanelViewController.h @@ -9,11 +9,9 @@ #import <UIKit/UIKit.h> #import <FAImageView.h> #import "LoginViewController.h" -#import "TitleView.h" #import <SDWebImage/UIImageView+WebCache.h> @interface RevealPanelViewController : UIViewController<UITableViewDataSource, UITableViewDelegate> @property (nonatomic, strong) IBOutlet UITableView *tableView; @property (nonatomic, strong) IBOutlet UIButton *signButton; -@property(nonatomic, strong) IBOutlet TitleView *titleView; @end diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m index fe44509..b79ceff 100644 --- a/Juick/RevealPanelViewController.m +++ b/Juick/RevealPanelViewController.m @@ -50,13 +50,11 @@ static NSString *CellIdentifier = @"NavCell"; [self.tableView setSeparatorInset:UIEdgeInsetsZero]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; self.tableView.separatorColor =[UIColor darkGrayColor]; - [self.tableView registerClass:[NavCell class] forCellReuseIdentifier:CellIdentifier]; + [self.tableView registerNib:[UINib nibWithNibName:@"NavCell" bundle:nil] forCellReuseIdentifier:CellIdentifier]; [self.view addSubview:self.tableView]; self.signButton = [[UIButton alloc] init]; [self.signButton addTarget:self action:@selector(signInOut) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.signButton]; - self.titleView = [[TitleView alloc] initWithImage:nil title:@"Juick"]; - [self.navigationItem setTitleView:self.titleView]; [self refreshInfo]; } @@ -70,8 +68,8 @@ static NSString *CellIdentifier = @"NavCell"; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ [User get:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] callback:^(User *user) { if (user != nil) { - [self.titleView.image setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/as/%@.png", user.uid]]]; - [self.titleView.title setText:user.uname]; + /*[self.titleView.image setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/as/%@.png", user.uid]]]; + [self.titleView.title setText:user.uname];*/ } }]; }); @@ -117,24 +115,24 @@ static NSString *CellIdentifier = @"NavCell"; NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; NSInteger row = indexPath.row; [cell.contentView setBackgroundColor:[ColorScheme navbarBackground]]; - cell.iconLabel.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f]; - cell.iconLabel.textColor = [ColorScheme navbarFont]; + cell.icon.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f]; + cell.icon.textColor = [ColorScheme navbarFont]; //cell.iconLabel.backgroundColor = [ColorScheme navbarBackground]; //cell.descriptionTextLabel.backgroundColor = [ColorScheme navbarBackground]; - cell.descriptionTextLabel.textColor = [ColorScheme navbarFont]; + cell.descriptionText.textColor = [ColorScheme navbarFont]; if (row == 0) { - cell.descriptionTextLabel.text = @"My feed"; - cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconHome]; + cell.descriptionText.text = @"My feed"; + cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconHome]; } else if (row == 1) { - cell.descriptionTextLabel.text = @"Popular"; - cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconComments]; + cell.descriptionText.text = @"Popular"; + cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconComments]; } else if (row == 2) { - cell.descriptionTextLabel.text = @"Discover"; - cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch]; + cell.descriptionText.text = @"Discover"; + cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch]; } else if (row == 3) { - cell.descriptionTextLabel.text = @"Images"; - cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture]; + cell.descriptionText.text = @"Images"; + cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture]; } UIView *bgColorView = [[UIView alloc] init]; bgColorView.backgroundColor = [UIColor blackColor]; diff --git a/Juick/TitleView.h b/Juick/TitleView.h deleted file mode 100644 index 17288ef..0000000 --- a/Juick/TitleView.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// TitleView.h -// Juick -// -// Created by Vitaly on 01.02.14. -// Copyright (c) 2014 com.juick. All rights reserved. -// - -#import <UIKit/UIKit.h> -#import "UILabel+Utils.h" -#import "ColorScheme.h" - -@interface TitleView : UIView -@property (nonatomic, strong) IBOutlet UIImageView *image; -@property (nonatomic, strong) IBOutlet UILabel *title; - --(id) initWithImage:(UIImage *) image title:(NSString *)title; - -@end diff --git a/Juick/TitleView.m b/Juick/TitleView.m deleted file mode 100644 index 3948041..0000000 --- a/Juick/TitleView.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// TitleView.m -// Juick -// -// Created by Vitaly on 01.02.14. -// Copyright (c) 2014 com.juick. All rights reserved. -// - -#import "TitleView.h" - -@implementation TitleView - --(id) initWithImage:(UIImage *)image title:(NSString *)title { - self = [super initWithFrame:CGRectMake(0, 0, 300.0f, 52.0f)]; - if (self) { - self.image = [[UIImageView alloc] init]; - self.image.image = image; - self.title = [[UILabel alloc] init]; - self.title.numberOfLines = 1; - self.title.textAlignment = NSTextAlignmentLeft; - self.title.text = title; - self.title.textColor = [ColorScheme navbarFont]; - [self addSubview:self.image]; - [self addSubview:self.title]; - } - return self; -} - --(void) layoutSubviews { - [super layoutSubviews]; - self.image.frame = CGRectMake(10, 10, 32, 32); - float textHeight = [UILabel sizeForLabel:self.title width:320.0f].size.height; - self.title.frame = CGRectMake(10 + 32 + 10, 10 + (32 - textHeight) / 2, - self.bounds.size.width - 32 - 10*3, textHeight); -} - -@end diff --git a/Juick/UILabel+Utils.h b/Juick/UILabel+Utils.h deleted file mode 100644 index 2e9cbb6..0000000 --- a/Juick/UILabel+Utils.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// UILabel+Utils.h -// Juick -// -// Created by Vitaly on 01.02.14. -// Copyright (c) 2014 com.juick. All rights reserved. -// - -#import <UIKit/UIKit.h> - -@interface UILabel (Utils) - -+ (CGRect) sizeForLabel:(UILabel *)label width:(CGFloat)width; - -@end diff --git a/Juick/UILabel+Utils.m b/Juick/UILabel+Utils.m deleted file mode 100644 index 91136d0..0000000 --- a/Juick/UILabel+Utils.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// UILabel+Utils.m -// Juick -// -// Created by Vitaly on 01.02.14. -// Copyright (c) 2014 com.juick. All rights reserved. -// - -#import "UILabel+Utils.h" - -@implementation UILabel (Utils) - -+ (CGRect) sizeForLabel:(UILabel *)label width:(CGFloat)width { - return [label.text boundingRectWithSize:(CGSize) {width, CGFLOAT_MAX} options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:label.font} context:nil]; -} -@end diff --git a/Juick/Views/NavCell.h b/Juick/Views/NavCell.h new file mode 100644 index 0000000..c8c2b41 --- /dev/null +++ b/Juick/Views/NavCell.h @@ -0,0 +1,14 @@ +// +// NavCell.h +// Juick +// +// Created by Vitaly Takmazov on 14/08/16. +// Copyright © 2016 com.juick. All rights reserved. +// + +#import <UIKit/UIKit.h> + +@interface NavCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UILabel *icon; +@property (weak, nonatomic) IBOutlet UILabel *descriptionText; +@end diff --git a/Juick/Views/NavCell.m b/Juick/Views/NavCell.m new file mode 100644 index 0000000..f2ab9f1 --- /dev/null +++ b/Juick/Views/NavCell.m @@ -0,0 +1,24 @@ +// +// NavCell.m +// Juick +// +// Created by Vitaly Takmazov on 14/08/16. +// Copyright © 2016 com.juick. All rights reserved. +// + +#import "NavCell.h" + +@implementation NavCell + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/Juick/Views/NavCell.xib b/Juick/Views/NavCell.xib new file mode 100644 index 0000000..bf2691d --- /dev/null +++ b/Juick/Views/NavCell.xib @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> + <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="NavCell" id="KGk-i7-Jjw" customClass="NavCell"> + <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> + <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="uyi-Iy-xUe"> + <rect key="frame" x="6" y="6" width="308" height="31"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dqo-um-Eh0"> + <rect key="frame" x="0.0" y="0.0" width="36" height="31"/> + <constraints> + <constraint firstAttribute="width" constant="36" id="VF9-mH-twl"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y8z-JG-Wj8"> + <rect key="frame" x="42" y="0.0" width="266" height="31"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + <constraints> + <constraint firstItem="uyi-Iy-xUe" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="2ay-nb-uYm"/> + <constraint firstAttribute="bottom" secondItem="uyi-Iy-xUe" secondAttribute="bottom" constant="6.5" id="Ks0-9y-A2A"/> + <constraint firstItem="uyi-Iy-xUe" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="6" id="TsO-i1-64l"/> + <constraint firstAttribute="trailing" secondItem="uyi-Iy-xUe" secondAttribute="trailing" constant="6" id="oNg-pG-xo1"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="descriptionText" destination="y8z-JG-Wj8" id="pKg-iv-fc3"/> + <outlet property="icon" destination="dqo-um-Eh0" id="0Io-ae-z3D"/> + </connections> + </tableViewCell> + </objects> +</document> |