| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // KNTableViewCell.m
- // kneet2
- //
- // Created by Jason Lee on 10/8/15.
- // Copyright © 2015 ntels. All rights reserved.
- //
- #import "KNTableViewCell.h"
- @interface KNTableViewCell () {
- BOOL _isNotFirstLoading;
- }
- @end
- @implementation KNTableViewCell
- - (void)drawRect:(CGRect)rect {
- [super drawRect:rect];
- if (!self.superview) {
- return;
- }
-
- if (!_isNotFirstLoading) {
- _isNotFirstLoading = YES;
-
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- for (NSLayoutConstraint *constraint in self.contentView.constraints) {
- // NSLog(@"%s\n %@", __PRETTY_FUNCTION__, constraint);
-
-
- if (constraint.firstAttribute == NSLayoutAttributeLeading || constraint.firstAttribute == NSLayoutAttributeTrailing) {
-
- if ([constraint.firstItem isEqual:self.contentView] || [constraint.secondItem isEqual:self.contentView]) {
- CGFloat constant = constraint.constant;
-
- if (constraint.constant == 10.0f || constraint.constant == 12.0f || constraint.constant == 15.0f || constraint.constant == 27.0f || constraint.constant == 28.0f || constraint.constant == 30.0f) {
-
- if (IPHONE_WIDTH == 414.0f) {//아이폰 6p일 경우,
- constant = constant + 20.0f;
- } else if (IPHONE_WIDTH == 375.0f) {//아이폰 6일경우
- constant = constant + 10.0f;
- }
- }
- constraint.constant = constant;
- }
- }
- }
- }
- }
- @end
- @interface KNTableViewCell2 () {
- BOOL _isNotFirstLoading;
- }
- @end
- @implementation KNTableViewCell2
- - (void)drawRect:(CGRect)rect {
- // [super drawRect:rect];
-
- if (!self.superview) {
- return;
- }
-
- // Initialization code
- // BOOL isHeader = [self isKindOfClass:[NSClassFromString(@"RulesConditionFooterTableViewCell") class]]; //for debug
-
- if (!_isNotFirstLoading) {
- _isNotFirstLoading = YES;
-
- self.selectionStyle = UITableViewCellSelectionStyleNone;
-
- for (NSLayoutConstraint *constraint in self.contentView.constraints) {
-
- if (constraint.firstAttribute == NSLayoutAttributeLeading || constraint.firstAttribute == NSLayoutAttributeTrailing) {
-
- if ([constraint.firstItem isEqual:self.contentView] || [constraint.secondItem isEqual:self.contentView]) {
- CGFloat constant = constraint.constant;
-
- if (constraint.constant == 10.0f || constraint.constant == 12.0f || constraint.constant == 15.0f || constraint.constant == 27.0f || constraint.constant == 28.0f || constraint.constant == 30.0f) {
-
- if (IPHONE_WIDTH == 414.0f) {//아이폰 6p일 경우,
- constant = constant + 10.0f;
- } else if (IPHONE_WIDTH == 375.0f) {//아이폰 6일경우
- constant = constant + 5.0f;
- }
- }
- constraint.constant = constant;
- }
- }
- }
- }
- }
- @end
|