diff options
author | Vitaly Takmazov | 2014-02-01 20:17:59 +0400 |
---|---|---|
committer | Vitaly Takmazov | 2014-02-01 20:17:59 +0400 |
commit | 552680443dea2ea5e3ce64d03dc4b6d2e39a7226 (patch) | |
tree | 73551b057735dd16406343831b5412c2ffb9c177 | |
parent | 50a0ecf985bbe81aacfac85192652c2495b769f6 (diff) |
Manual layout in reveal panel, deployment target now ios 5.1
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 10 | ||||
-rw-r--r-- | Juick/NavCell.h | 2 | ||||
-rw-r--r-- | Juick/NavCell.m | 27 | ||||
-rw-r--r-- | Juick/RevealPanelViewController.m | 4 |
4 files changed, 23 insertions, 20 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index a6f89ef..5b1df20 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ 77A0954A181F1F25002BDECD /* Message.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A09549181F1F25002BDECD /* Message.m */; }; 77A5BDB0189AEB28000F8D9E /* 0.png in Resources */ = {isa = PBXBuildFile; fileRef = 77A5BDAF189AEB28000F8D9E /* 0.png */; }; 77B09994189D0B9900A84F59 /* UIImage+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 77B09993189D0B9900A84F59 /* UIImage+Utils.m */; }; + 77B099A3189D516800A84F59 /* UILabel+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 77B099A2189D516800A84F59 /* UILabel+Utils.m */; }; 77C67EDE182827DB00427098 /* reveal-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 77C67EDC182827DB00427098 /* reveal-icon.png */; }; 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 */; }; @@ -87,6 +88,8 @@ 77A5BDAF189AEB28000F8D9E /* 0.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 0.png; sourceTree = "<group>"; }; 77B09992189D0B9900A84F59 /* UIImage+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Utils.h"; sourceTree = "<group>"; }; 77B09993189D0B9900A84F59 /* UIImage+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Utils.m"; sourceTree = "<group>"; }; + 77B099A1189D516800A84F59 /* UILabel+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Utils.h"; sourceTree = "<group>"; }; + 77B099A2189D516800A84F59 /* UILabel+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Utils.m"; sourceTree = "<group>"; }; 77C67EDC182827DB00427098 /* reveal-icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reveal-icon.png"; sourceTree = "<group>"; }; 77C67EDD182827DB00427098 /* reveal-icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reveal-icon@2x.png"; sourceTree = "<group>"; }; 77C67EE01828288C00427098 /* RevealPanelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RevealPanelViewController.h; sourceTree = "<group>"; }; @@ -173,6 +176,8 @@ 77317BB1181BBE8500D60005 /* Juick */ = { isa = PBXGroup; children = ( + 77B099A1189D516800A84F59 /* UILabel+Utils.h */, + 77B099A2189D516800A84F59 /* UILabel+Utils.m */, 77A5BDAF189AEB28000F8D9E /* 0.png */, 77418CC0182FBABB004111B7 /* iTunesArtwork@2x */, 77418CBA182F9A78004111B7 /* AttachPlaceholder@2x.png */, @@ -383,6 +388,7 @@ 77A0954A181F1F25002BDECD /* Message.m in Sources */, 77B09994189D0B9900A84F59 /* UIImage+Utils.m in Sources */, 771E4AD618606AA400EBACC8 /* NavCell.m in Sources */, + 77B099A3189D516800A84F59 /* UILabel+Utils.m in Sources */, 77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */, 77C67EE21828288C00427098 /* RevealPanelViewController.m in Sources */, 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */, @@ -511,7 +517,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Juick-Prefix.pch"; INFOPLIST_FILE = "Juick/Juick-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -528,7 +534,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Juick/Juick-Prefix.pch"; INFOPLIST_FILE = "Juick/Juick-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 5.1; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; diff --git a/Juick/NavCell.h b/Juick/NavCell.h index 50eec8d..e210636 100644 --- a/Juick/NavCell.h +++ b/Juick/NavCell.h @@ -8,6 +8,8 @@ #import <UIKit/UIKit.h> +#import "UILabel+Utils.h" + @interface NavCell : UITableViewCell @property (strong, nonatomic) IBOutlet UILabel *iconLabel; @property (strong, nonatomic) IBOutlet UILabel *descriptionTextLabel; diff --git a/Juick/NavCell.m b/Juick/NavCell.m index 0b16e43..594b23b 100644 --- a/Juick/NavCell.m +++ b/Juick/NavCell.m @@ -23,31 +23,22 @@ self.backgroundColor = [UIColor blackColor]; 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)updateConstraints { - [super updateConstraints]; +- (void)layoutSubviews { + [super layoutSubviews]; - 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; + CGRect iconRect = [UILabel sizeForLabel:self.iconLabel width:320.0f]; + self.iconLabel.frame = CGRectMake(10, 10, iconRect.size.width, iconRect.size.height); + float textHeight = [UILabel sizeForLabel:self.descriptionTextLabel width:320.0f].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.m b/Juick/RevealPanelViewController.m index c39c6cd..9d27608 100644 --- a/Juick/RevealPanelViewController.m +++ b/Juick/RevealPanelViewController.m @@ -64,6 +64,10 @@ static NSString *CellIdentifier = @"NavCell"; return 4; } +- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 32 + 10*2; // icon size + insets +} + - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; NSInteger row = indexPath.row; |