From ce630eef61d4acd8f5c4e1d6a3a60780c5ec4af3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 18 Dec 2013 05:53:29 +0400 Subject: cleanup and ios6 fixes --- Juick/NavCell.m | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Juick/NavCell.m (limited to 'Juick/NavCell.m') 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 -- cgit v1.2.3