summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2014-02-01 20:17:59 +0400
committerGravatar Vitaly Takmazov2014-02-01 20:17:59 +0400
commit552680443dea2ea5e3ce64d03dc4b6d2e39a7226 (patch)
tree73551b057735dd16406343831b5412c2ffb9c177 /Juick
parent50a0ecf985bbe81aacfac85192652c2495b769f6 (diff)
Manual layout in reveal panel, deployment target now ios 5.1
Diffstat (limited to 'Juick')
-rw-r--r--Juick/NavCell.h2
-rw-r--r--Juick/NavCell.m27
-rw-r--r--Juick/RevealPanelViewController.m4
3 files changed, 15 insertions, 18 deletions
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;