Reset contact selection mode after edit

Fix image zoom
This commit is contained in:
Yann Diorcet 2012-09-28 16:23:15 +02:00
parent cb9e977bf3
commit 7db406cdb6
4 changed files with 15 additions and 7 deletions

View file

@ -299,6 +299,9 @@ static UICompositeViewDescription *compositeDescription = nil;
}
- (IBAction)onBackClick:(id)event {
if([ContactSelection getSelectionMode] == ContactSelectionModeEdit) {
[ContactSelection setSelectionMode:ContactSelectionModeNone];
}
[[PhoneMainView instance] popCurrentView];
}

View file

@ -217,7 +217,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
// Go to Contact details view
ContactDetailsViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ContactDetailsViewController compositeViewDescription] push:TRUE], ContactDetailsViewController);
if(controller != nil) {
if([ContactSelection getAddAddress] == nil) {
if([ContactSelection getSelectionMode] != ContactSelectionModeEdit) {
[controller setContact:lPerson];
} else {
[controller editContact:lPerson address:[ContactSelection getAddAddress]];

View file

@ -22,7 +22,7 @@
#import "UICompositeViewController.h"
@interface UIImageScrollView : UIScrollView<UIScrollViewDelegate>
@property (nonatomic, retain) UIImage *image;
@property (readonly) IBOutlet UIImageView *imageView;

View file

@ -30,7 +30,7 @@
- (void)initUIImageScrollView {
imageView = [[UIImageView alloc] init];
self.delegate = self;
self.delegate = self;
[self addSubview:imageView];
}
@ -70,11 +70,11 @@
- (void)layoutSubviews {
[super layoutSubviews];
// center the image as it becomes smaller than the size of the screen
CGSize boundsSize = self.bounds.size;
CGRect frameToCenter = imageView.frame;
// center horizontally
if (frameToCenter.size.width < boundsSize.width)
frameToCenter.origin.x = (boundsSize.width - frameToCenter.size.width) / 2;
@ -87,6 +87,7 @@
else
frameToCenter.origin.y = 0;
imageView.frame = frameToCenter;
}
@ -94,10 +95,14 @@
#pragma mark - Property Functions
- (void)setImage:(UIImage *)aimage {
self.minimumZoomScale = 0;
self.zoomScale = 1;
CGRect rect = CGRectMake(0, 0, aimage.size.width, aimage.size.height);
imageView.image = aimage;
imageView.frame = CGRectMake(0, 0, aimage.size.width, aimage.size.height);
self.contentSize = aimage.size;
[self zoomToRect:imageView.bounds animated:FALSE];
imageView.frame = rect;
self.contentSize = rect.size;
[self zoomToRect:rect animated:FALSE];
self.minimumZoomScale = self.zoomScale;
}