mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
contact: rotate photo when invalid rotation
This commit is contained in:
parent
f357fd0975
commit
f6747e1ffc
4 changed files with 30 additions and 3 deletions
|
|
@ -556,6 +556,15 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark ImagePickerDelegate
|
||||
|
||||
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
|
||||
// When getting image from the camera, it may be 90° rotated due to orientation
|
||||
// (image.imageOrientation = UIImageOrientationRight). Just rotate it to be face up.
|
||||
if (image.imageOrientation != UIImageOrientationUp) {
|
||||
UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale);
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
}
|
||||
|
||||
// Dismiss popover on iPad
|
||||
if (IPAD) {
|
||||
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
|
||||
|
|
|
|||
|
|
@ -79,10 +79,10 @@
|
|||
added = [_contact addEmail:value];
|
||||
}
|
||||
|
||||
if (added && animated) {
|
||||
if (added) {
|
||||
NSUInteger count = [self getSectionData:section].count;
|
||||
[tableview insertRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:count - 1 inSection:section] ]
|
||||
withRowAnimation:UITableViewRowAnimationFade];
|
||||
withRowAnimation:animated ? UITableViewRowAnimationFade : UITableViewRowAnimationNone];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@
|
|||
|
||||
[self removeEmptyEntry:self.tableView section:section animated:NO];
|
||||
// the section is empty -> remove titles
|
||||
if ([[self getSectionData:section] count] == 0 && animated) {
|
||||
if ([[self getSectionData:section] count] == 0) {
|
||||
[self.tableView
|
||||
reloadSections:[NSIndexSet indexSetWithIndex:section]
|
||||
withRowAnimation:animated ? UITableViewRowAnimationFade : UITableViewRowAnimationNone];
|
||||
|
|
|
|||
|
|
@ -310,6 +310,15 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - Image picker delegate
|
||||
|
||||
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
|
||||
// When getting image from the camera, it may be 90° rotated due to orientation
|
||||
// (image.imageOrientation = UIImageOrientationRight). Just rotate it to be face up.
|
||||
if (image.imageOrientation != UIImageOrientationUp) {
|
||||
UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale);
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
}
|
||||
|
||||
// Dismiss popover on iPad
|
||||
if (IPAD) {
|
||||
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
|
||||
|
|
|
|||
|
|
@ -99,6 +99,15 @@
|
|||
#pragma mark - Image picker delegate
|
||||
|
||||
- (void)imagePickerDelegateImage:(UIImage *)image info:(NSDictionary *)info {
|
||||
// When getting image from the camera, it may be 90° rotated due to orientation
|
||||
// (image.imageOrientation = UIImageOrientationRight). Just rotate it to be face up.
|
||||
if (image.imageOrientation != UIImageOrientationUp) {
|
||||
UIGraphicsBeginImageContextWithOptions(image.size, false, image.scale);
|
||||
[image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
}
|
||||
|
||||
// Dismiss popover on iPad
|
||||
if (IPAD) {
|
||||
[VIEW(ImagePickerView).popoverController dismissPopoverAnimated:TRUE];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue