Skip to content

Commit

Permalink
Remove iOS 6 compatibility code
Browse files Browse the repository at this point in the history
  • Loading branch information
romaonthego committed Mar 3, 2015
1 parent 4e04c28 commit 9afe3b4
Show file tree
Hide file tree
Showing 24 changed files with 2,428 additions and 2,561 deletions.
2 changes: 1 addition & 1 deletion RETableViewManager/Cells/RETableViewBoolCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ - (void)cellDidLoad
[self.switchView addTarget:self action:@selector(switchValueDidChange:) forControlEvents:UIControlEventValueChanged];
[self.contentView addSubview:self.switchView];

CGFloat margin = (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0) ? 15.0 : 10.0;
CGFloat margin = (self.section.style.contentViewMargin <= 0) ? 15.0 : 10.0;
NSDictionary *metrics = @{@"margin": @(margin)};
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:self.switchView
attribute:NSLayoutAttributeCenterY
Expand Down
4 changes: 2 additions & 2 deletions RETableViewManager/Cells/RETableViewCreditCardCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ - (void)cellWillAppear
{
CGFloat cellOffset = 10.0;

if (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0)
if (self.section.style.contentViewMargin <= 0)
cellOffset += 5.0;
self.creditCardImageViewContainer.frame = CGRectMake(cellOffset, 5, 32, 32);

Expand Down Expand Up @@ -242,7 +242,7 @@ - (void)layoutSubviews
frame.size.height = self.contentView.frame.size.height;
self.cvvField.frame = frame;

self.ribbonExpired.frame = CGRectMake(CGRectGetWidth(self.contentView.frame) - self.ribbonExpired.image.size.width + 1 + (REUIKitIsFlatMode() ? 1 : 0), -2, self.ribbonExpired.image.size.width, self.ribbonExpired.image.size.height);
self.ribbonExpired.frame = CGRectMake(CGRectGetWidth(self.contentView.frame) - self.ribbonExpired.image.size.width + 2, -2, self.ribbonExpired.image.size.width, self.ribbonExpired.image.size.height);

if (self.isNumberEditingMode) {
self.creditCardField.frame = CGRectMake(0, self.creditCardField.frame.origin.y, self.creditCardField.frame.size.width, self.creditCardField.frame.size.height);
Expand Down
2 changes: 1 addition & 1 deletion RETableViewManager/Cells/RETableViewFloatCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ - (void)layoutSubviews
{
[super layoutSubviews];
CGFloat cellOffset = 10.0;
if (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0)
if (self.section.style.contentViewMargin <= 0)
cellOffset += 5.0;

self.sliderView.frame = CGRectMake(self.contentView.frame.size.width - self.item.sliderWidth - cellOffset, (self.contentView.frame.size.height - self.sliderView.frame.size.height) / 2.0, self.item.sliderWidth, 23.0);
Expand Down
6 changes: 2 additions & 4 deletions RETableViewManager/Cells/RETableViewLongTextCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ - (void)cellDidLoad

UILabel *label = self.textLabel;

CGFloat padding = (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0) ? 7 : 2;
CGFloat padding = (self.section.style.contentViewMargin <= 0) ? 7 : 2;
NSDictionary *metrics = @{ @"padding": @(padding) };
UITextView *textView = self.textView;
[self.contentView removeConstraints:self.contentView.constraints];
Expand Down Expand Up @@ -105,9 +105,7 @@ - (void)cellWillAppear
self.textView.secureTextEntry = self.item.secureTextEntry;
[self.textView setNeedsDisplay];

if (REUIKitIsFlatMode()) {
self.actionBar.barStyle = self.item.keyboardAppearance == UIKeyboardAppearanceAlert ? UIBarStyleBlack : UIBarStyleDefault;
}
self.actionBar.barStyle = self.item.keyboardAppearance == UIKeyboardAppearanceAlert ? UIBarStyleBlack : UIBarStyleDefault;

self.enabled = self.item.enabled;
}
Expand Down
8 changes: 3 additions & 5 deletions RETableViewManager/Cells/RETableViewOptionCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ - (void)layoutSubviews
{
[super layoutSubviews];
[self layoutDetailView:self.valueLabel minimumWidth:[self.valueLabel.text re_sizeWithFont:self.valueLabel.font].width];
if (REUIKitIsFlatMode()) {
CGRect frame = self.valueLabel.frame;
frame.size.width += 10.0;
self.valueLabel.frame = frame;
}
CGRect frame = self.valueLabel.frame;
frame.size.width += 10.0;
self.valueLabel.frame = frame;

if ([self.tableViewManager.delegate respondsToSelector:@selector(tableView:willLayoutCellSubviews:forRowAtIndexPath:)])
[self.tableViewManager.delegate tableView:self.tableViewManager.tableView willLayoutCellSubviews:self forRowAtIndexPath:[self.tableViewManager.tableView indexPathForCell:self]];
Expand Down
2 changes: 1 addition & 1 deletion RETableViewManager/Cells/RETableViewSegmentedCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ - (void)cellWillAppear
// Clears previous constraints.
[self.contentView removeConstraints:self.horizontalConstraints];
}
CGFloat margin = (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0) ? 15.0 : 10.0;
CGFloat margin = (self.section.style.contentViewMargin <= 0) ? 15.0 : 10.0;
NSDictionary *metrics = @{@"margin": @(margin)};
if (self.item.title.length > 0) {
self.horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[_segmentedControl(>=140)]-margin-|" options:0 metrics:metrics views:NSDictionaryOfVariableBindings(_segmentedControl)];
Expand Down
4 changes: 1 addition & 3 deletions RETableViewManager/Cells/RETableViewTextCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ - (void)cellWillAppear
self.textField.clearButtonMode = self.item.clearButtonMode;
self.textField.clearsOnBeginEditing = self.item.clearsOnBeginEditing;

if (REUIKitIsFlatMode()) {
self.actionBar.barStyle = self.item.keyboardAppearance == UIKeyboardAppearanceAlert ? UIBarStyleBlack : UIBarStyleDefault;
}
self.actionBar.barStyle = self.item.keyboardAppearance == UIKeyboardAppearanceAlert ? UIBarStyleBlack : UIBarStyleDefault;

self.enabled = self.item.enabled;
}
Expand Down
1 change: 0 additions & 1 deletion RETableViewManager/NSString+RETableViewManagerAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
//

#import "NSString+RETableViewManagerAdditions.h"
#import "RECommonFunctions.h"

@implementation NSString (RETableViewManagerAdditions)

Expand Down
34 changes: 12 additions & 22 deletions RETableViewManager/REActionBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,24 @@ - (id)initWithDelegate:(id)delegate

[self sizeToFit];

if (!REUIKitIsFlatMode()) {
self.translucent = YES;
self.barStyle = UIBarStyleBlackTranslucent;
}

UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(handleActionBarDone:)];

self.navigationControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:NSLocalizedString(@"Previous", @""), NSLocalizedString(@"Next", @""), nil]];
self.navigationControl.momentary = YES;
#if __IPHONE_OS_VERSION_MIN_REQUIRED < 70000
self.navigationControl.segmentedControlStyle = UISegmentedControlStyleBar;
#endif
[self.navigationControl addTarget:self action:@selector(handleActionBarPreviousNext:) forControlEvents:UIControlEventValueChanged];

if (REUIKitIsFlatMode()) {
[self.navigationControl setImage:[UIImage imageNamed:@"RETableViewManager.bundle/UIButtonBarArrowLeft"] forSegmentAtIndex:0];
[self.navigationControl setImage:[UIImage imageNamed:@"RETableViewManager.bundle/UIButtonBarArrowRight"] forSegmentAtIndex:1];

[self.navigationControl setDividerImage:[[UIImage alloc] init]
forLeftSegmentState:UIControlStateNormal
rightSegmentState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];

[self.navigationControl setBackgroundImage:[UIImage imageNamed:@"RETableViewManager.bundle/Transparent"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[self.navigationControl setWidth:40.0f forSegmentAtIndex:0];
[self.navigationControl setWidth:40.0f forSegmentAtIndex:1];
[self.navigationControl setContentOffset:CGSizeMake(-4, 0) forSegmentAtIndex:0];
}
[self.navigationControl setImage:[UIImage imageNamed:@"RETableViewManager.bundle/UIButtonBarArrowLeft"] forSegmentAtIndex:0];
[self.navigationControl setImage:[UIImage imageNamed:@"RETableViewManager.bundle/UIButtonBarArrowRight"] forSegmentAtIndex:1];

[self.navigationControl setDividerImage:[[UIImage alloc] init]
forLeftSegmentState:UIControlStateNormal
rightSegmentState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];

[self.navigationControl setBackgroundImage:[UIImage imageNamed:@"RETableViewManager.bundle/Transparent"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[self.navigationControl setWidth:40.0f forSegmentAtIndex:0];
[self.navigationControl setWidth:40.0f forSegmentAtIndex:1];
[self.navigationControl setContentOffset:CGSizeMake(-4, 0) forSegmentAtIndex:0];

UIBarButtonItem *prevNextWrapper = [[UIBarButtonItem alloc] initWithCustomView:self.navigationControl];
UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
Expand Down
2 changes: 1 addition & 1 deletion RETableViewManager/RETableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ - (void)layoutDetailView:(UIView *)view minimumWidth:(CGFloat)minimumWidth
CGFloat cellOffset = 10.0;
CGFloat fieldOffset = 10.0;

if (REUIKitIsFlatMode() && self.section.style.contentViewMargin <= 0)
if (self.section.style.contentViewMargin <= 0)
cellOffset += 5.0;

UIFont *font = self.textLabel.font;
Expand Down
2 changes: 1 addition & 1 deletion RETableViewManager/RETableViewManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#import <UIKit/UIKit.h>
#import <REValidation/REValidation.h>
#import "RECommonFunctions.h"
#import "RETableViewSection.h"
#import "RETableViewCellStyle.h"
#import "RETableViewCell.h"
Expand All @@ -51,6 +50,7 @@
#import "RESegmentedItem.h"
#import "REInlineDatePickerItem.h"
#import "REInlinePickerItem.h"
#import "NSString+RETableViewManagerAdditions.h"

@protocol RETableViewManagerDelegate;

Expand Down
42 changes: 10 additions & 32 deletions RETableViewManager/RETableViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -444,23 +444,12 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege

CGSize headerRect = CGSizeMake(headerWidth, RETableViewSectionHeaderHeightAutomatic);

IF_IOS7_OR_GREATER (
CGRect headerFrame = [section.headerTitle boundingRectWithSize:headerRect
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
attributes:@{ NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] }
context:nil];

headerHeight = headerFrame.size.height;
) else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
CGSize headerFrameSize = [section.headerTitle sizeWithFont:[UIFont systemFontOfSize:13.0f]
constrainedToSize:headerRect
lineBreakMode:NSLineBreakByWordWrapping];
#pragma clang diagnostic pop
CGRect headerFrame = [section.headerTitle boundingRectWithSize:headerRect
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
attributes:@{ NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] }
context:nil];

headerHeight = headerFrameSize.height;
}
headerHeight = headerFrame.size.height;

return headerHeight + 20.0f;
}
Expand Down Expand Up @@ -496,23 +485,12 @@ - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSIntege

CGSize footerRect = CGSizeMake(footerWidth, RETableViewSectionFooterHeightAutomatic);

IF_IOS7_OR_GREATER (
CGRect footerFrame = [section.footerTitle boundingRectWithSize:footerRect
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
attributes:@{ NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote] }
context:nil];

footerHeight = footerFrame.size.height;
) else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
CGSize footerFrameSize = [section.footerTitle sizeWithFont:[UIFont systemFontOfSize:13.0f]
constrainedToSize:footerRect
lineBreakMode:NSLineBreakByWordWrapping];
#pragma clang diagnostic pop
CGRect footerFrame = [section.footerTitle boundingRectWithSize:footerRect
options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
attributes:@{ NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote] }
context:nil];

footerHeight = footerFrameSize.height;
}
footerHeight = footerFrame.size.height;

return footerHeight + 10.0f;
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9afe3b4

Please sign in to comment.