Selaa lähdekoodia

Remove guards against using API added in iOS 7

Deployment target has been bumped to iOS 7
Ryan Olson 11 vuotta sitten
vanhempi
commit
99e8f112b2

+ 3 - 9
Classes/Explorer Toolbar/FLEXExplorerViewController.m

@@ -851,11 +851,8 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     // If this app doesn't use view controller based status bar management and we're on iOS 7+,
     // make sure the status bar style is UIStatusBarStyleDefault. We don't actully have to check
     // for view controller based management because the global methods no-op if that is turned on.
-    // Only for iOS 7+
-    if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
-        self.previousStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
-        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
-    }
+    self.previousStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
+    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
     
     // Show the view controller.
     [self presentViewController:viewController animated:animated completion:completion];
@@ -872,10 +869,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     [[self statusWindow] setWindowLevel:UIWindowLevelStatusBar];
     
     // Restore the stauts bar style if the app is using global status bar management.
-    // Only for iOS 7+
-    if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
-        [[UIApplication sharedApplication] setStatusBarStyle:self.previousStatusBarStyle];
-    }
+    [[UIApplication sharedApplication] setStatusBarStyle:self.previousStatusBarStyle];
     
     [self dismissViewControllerAnimated:animated completion:completion];
 }

+ 1 - 6
Classes/Object Explorers/FLEXViewExplorerViewController.m

@@ -163,12 +163,7 @@ typedef NS_ENUM(NSUInteger, FLEXViewExplorerRow) {
     if (!CGRectIsEmpty(view.bounds)) {
         CGSize viewSize = view.bounds.size;
         UIGraphicsBeginImageContextWithOptions(viewSize, NO, 0.0);
-        if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
-            [view drawViewHierarchyInRect:CGRectMake(0, 0, viewSize.width, viewSize.height) afterScreenUpdates:YES];
-        } else {
-            CGContextRef imageContext = UIGraphicsGetCurrentContext();
-            [view.layer renderInContext:imageContext];
-        }
+        [view drawViewHierarchyInRect:CGRectMake(0, 0, viewSize.width, viewSize.height) afterScreenUpdates:YES];
         UIImage *previewImage = UIGraphicsGetImageFromCurrentImageContext();
         UIGraphicsEndImageContext();
         imagePreviewViewController = [[FLEXImagePreviewViewController alloc] initWithImage:previewImage];

+ 1 - 25
Classes/Utility/FLEXMultilineTableViewCell.m

@@ -30,36 +30,12 @@ NSString *const kFLEXMultilineTableViewCellIdentifier = @"kFLEXMultilineTableVie
 
 + (UIEdgeInsets)labelInsets
 {
-    UIEdgeInsets labelInsets = UIEdgeInsetsZero;
-    labelInsets.top = 10.0;
-    labelInsets.bottom = 10.0;
-    if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
-        labelInsets.left = 15.0;
-        labelInsets.right = 15.0;
-    } else {
-        labelInsets.left = 10.0;
-        labelInsets.right = 10.0;
-    }
-    return labelInsets;
+    return UIEdgeInsetsMake(10.0, 15.0, 10.0, 15.0);
 }
 
 + (CGFloat)preferredHeightWithAttributedText:(NSAttributedString *)attributedText inTableViewWidth:(CGFloat)tableViewWidth style:(UITableViewStyle)style showsAccessory:(BOOL)showsAccessory
 {
-    // Hardcoded margins from observation of cells in a grouped table on iOS 6.
-    // There is no API to get the insets of the content view proir to layout.
-    // Thankfully they removed the magic margins in iOS 7.
-    // Differences are between the content view's width and the table view's width
-    // Full screen iPhone - 20
-    // Full screen iPad - 90
-
     CGFloat labelWidth = tableViewWidth;
-    if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1 && style == UITableViewStyleGrouped) {
-        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
-            labelWidth -= 40.0;
-        } else {
-            labelWidth -= 90.0;
-        }
-    }
 
     // Content view inset due to accessory view observed on iOS 8.1 iPhone 6.
     if (showsAccessory) {

+ 1 - 7
Classes/View Hierarchy/FLEXHierarchyTableViewCell.m

@@ -37,13 +37,7 @@
         
         self.textLabel.font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:14.0];
         self.detailTextLabel.font = [FLEXUtility defaultTableViewCellLabelFont];
-        
-        if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
-            // Supported starting with iOS 7
-            self.accessoryType = UITableViewCellAccessoryDetailButton;
-        } else {
-            self.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
-        }
+        self.accessoryType = UITableViewCellAccessoryDetailButton;
     }
     return self;
 }

+ 1 - 3
Classes/View Hierarchy/FLEXHierarchyTableViewController.m

@@ -56,9 +56,7 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
     self.tableView.rowHeight = 50.0;
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
     // Separator inset clashes with persistent cell selection.
-    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
-        [self.tableView setSeparatorInset:UIEdgeInsetsZero];
-    }
+    [self.tableView setSeparatorInset:UIEdgeInsetsZero];
     
     self.searchBar = [[UISearchBar alloc] init];
     self.searchBar.placeholder = [FLEXUtility searchBarPlaceholderText];