|
@@ -236,10 +236,25 @@
|
|
[self updatePreferredContentSizeWithTraitCollection:newCollection];
|
|
[self updatePreferredContentSizeWithTraitCollection:newCollection];
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
#pragma mark - Private Methods
|
|
#pragma mark - Private Methods
|
|
|
|
|
|
- (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
|
|
- (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
|
|
- self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 750);
|
|
|
|
|
|
+ CGFloat width = [UIScreen mainScreen].bounds.size.width;
|
|
|
|
+ CGFloat height = [UIScreen mainScreen].bounds.size.height;
|
|
|
|
+
|
|
|
|
+ CGFloat mWidth = fmin(width, height);
|
|
|
|
+ CGFloat mHeight = fmax(width, height);
|
|
|
|
+
|
|
|
|
+ UIDevice *currentDevice = [UIDevice currentDevice];
|
|
|
|
+ if (currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
|
|
|
|
+ // This is an iPad
|
|
|
|
+ self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.5 : mHeight*0.6);
|
|
|
|
+ } else {
|
|
|
|
+ // This is an iPhone or iPod touch
|
|
|
|
+ self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? mWidth*0.9 : mHeight*0.9);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- (void)createGestureRecognizer {
|
|
- (void)createGestureRecognizer {
|
|
@@ -410,6 +425,10 @@
|
|
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
|
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
|
imagePickerController.allowsEditing = YES;
|
|
imagePickerController.allowsEditing = YES;
|
|
imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
|
|
imagePickerController.modalPresentationStyle = UIModalPresentationPopover;
|
|
|
|
+ if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) {
|
|
|
|
+ imagePickerController.popoverPresentationController.sourceView = self.segmentedControl;;
|
|
|
|
+ imagePickerController.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMaxX(self.segmentedControl.bounds), CGRectGetMaxY(self.segmentedControl.bounds), 1, 1);
|
|
|
|
+ }
|
|
[self presentViewController:imagePickerController animated:YES completion:nil];
|
|
[self presentViewController:imagePickerController animated:YES completion:nil];
|
|
}];
|
|
}];
|
|
|
|
|
|
@@ -437,7 +456,7 @@
|
|
|
|
|
|
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
|
|
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
|
|
[picker dismissViewControllerAnimated:YES completion:nil];
|
|
[picker dismissViewControllerAnimated:YES completion:nil];
|
|
- UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
|
|
|
|
|
|
+ UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
|
|
|
|
|
|
UIImageOrientation imageOrientation = image.imageOrientation;
|
|
UIImageOrientation imageOrientation = image.imageOrientation;
|
|
if (imageOrientation!=UIImageOrientationUp) {
|
|
if (imageOrientation!=UIImageOrientationUp) {
|