Skip to content

Commit 0d2fd1d

Browse files
authored
Merge pull request #321 from TimOliver/remove-ios-7
Remove iOS 7 Support
2 parents 7dcec5d + c7754cb commit 0d2fd1d

File tree

2 files changed

+11
-35
lines changed

2 files changed

+11
-35
lines changed

Objective-C/TOCropViewController/TOCropViewController.m

+6-17
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ @interface TOCropViewController () <UIActionSheetDelegate, UIViewControllerTrans
6767
/* Flag to perform initial setup on the first run */
6868
@property (nonatomic, assign) BOOL firstTime;
6969

70-
/* On iOS 7, the popover view controller that appears when tapping 'Done' */
71-
#pragma clang diagnostic push
72-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
73-
@property (nonatomic, strong) UIPopoverController *activityPopoverController;
74-
#pragma clang diagnostic pop
75-
7670
@end
7771

7872
@implementation TOCropViewController
@@ -456,11 +450,7 @@ - (void)viewDidLayoutSubviews
456450

457451
#pragma mark - Rotation Handling -
458452

459-
//TODO: Deprecate iOS 7 properly at the right time
460-
#pragma clang diagnostic push
461-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
462-
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
463-
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
453+
- (void)_willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
464454
{
465455
self.toolbarSnapshotView = [self.toolbar snapshotViewAfterScreenUpdates:NO];
466456
self.toolbarSnapshotView.frame = self.toolbar.frame;
@@ -492,7 +482,7 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
492482
self.cropView.internalLayoutDisabled = YES;
493483
}
494484

495-
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
485+
- (void)_willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
496486
{
497487
//Remove all animations in the toolbar
498488
self.toolbar.frame = [self frameForToolbarWithVerticalLayout:!UIInterfaceOrientationIsLandscape(toInterfaceOrientation)];
@@ -517,7 +507,7 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
517507
self.toolbar.alpha = 1.0f;
518508
}
519509

520-
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
510+
- (void)_didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
521511
{
522512
[self.toolbarSnapshotView removeFromSuperview];
523513
self.toolbarSnapshotView = nil;
@@ -539,14 +529,13 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
539529
orientation = UIInterfaceOrientationLandscapeLeft;
540530
}
541531

542-
[self willRotateToInterfaceOrientation:orientation duration:coordinator.transitionDuration];
532+
[self _willRotateToInterfaceOrientation:orientation duration:coordinator.transitionDuration];
543533
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
544-
[self willAnimateRotationToInterfaceOrientation:orientation duration:coordinator.transitionDuration];
534+
[self _willAnimateRotationToInterfaceOrientation:orientation duration:coordinator.transitionDuration];
545535
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
546-
[self didRotateFromInterfaceOrientation:orientation];
536+
[self _didRotateFromInterfaceOrientation:orientation];
547537
}];
548538
}
549-
#pragma clang diagnostic pop
550539

551540
#pragma mark - Reset -
552541
- (void)resetCropViewLayout

Objective-C/TOCropViewControllerExample/ViewController.m

+5-18
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ @interface ViewController () <UINavigationControllerDelegate, UIImagePickerContr
1818
@property (nonatomic, assign) CGRect croppedFrame;
1919
@property (nonatomic, assign) NSInteger angle;
2020

21-
#pragma clang diagnostic push
22-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
23-
@property (nonatomic, strong) UIPopoverController *activityPopoverController;
24-
#pragma clang diagnostic pop
25-
2621
@end
2722

2823
@implementation ViewController
@@ -223,23 +218,15 @@ - (void)showCropViewController
223218
[self presentViewController:alertController animated:YES completion:nil];
224219
}
225220

226-
- (void)sharePhoto
221+
- (void)sharePhoto:(id)sender
227222
{
228223
if (self.imageView.image == nil)
229224
return;
230225

231226
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[self.imageView.image] applicationActivities:nil];
232-
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
233-
[self presentViewController:activityController animated:YES completion:nil];
234-
}
235-
else {
236-
#pragma clang diagnostic push
237-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
238-
[self.activityPopoverController dismissPopoverAnimated:NO];
239-
self.activityPopoverController = [[UIPopoverController alloc] initWithContentViewController:activityController];
240-
[self.activityPopoverController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
241-
#pragma clang diagnostic pop
242-
}
227+
activityController.modalPresentationStyle = UIModalPresentationPopover;
228+
activityController.popoverPresentationController.barButtonItem = sender;
229+
[self presentViewController:activityController animated:YES completion:nil];
243230
}
244231

245232
- (void)dismissViewController {
@@ -258,7 +245,7 @@ - (void)viewDidLoad {
258245
#if TARGET_APP_EXTENSION
259246
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismissViewController)];
260247
#else
261-
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(sharePhoto)];
248+
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(sharePhoto:)];
262249
self.navigationItem.rightBarButtonItem.enabled = NO;
263250
#endif
264251

0 commit comments

Comments
 (0)