*   >> Lese Utdanning Artikler >> science >> programming

iPhone Endre størrelse en UIImage

synthesize knappen, bildeVis, buttonImage, imageViewImage, selectingButtonImage, selectingImageViewImage;

//Implementere viewDidLoad å gjøre ekstra oppsett etter lasting utsikten, vanligvis fra en spiss

- (void) viewDidLoad {

[superviewDidLoad];.

selectingButtonImage = NO ;

selectingImageViewImage = NO;

UIImage * scaledButtonImage = [buttonImagescaleToSize: CGSizeMake (120.0f, 120.0f)];

UIImage * scaledImageViewImage = [imageViewImagescaleToSize: CGSizeMake (100,0 f, 100.

0f)];

[buttonsetImage: scaledButtonImage forState: UIControlStateNormal];

[imageViewsetImage: scaledImageViewImage];

}

- (void ) viewWillAppear: (BOOL) animert {

[superviewWillAppear: animerte];

UIImage * scaledButtonImage = [buttonImagescaleToSize: CGSizeMake (120.0f, 120.0f)];

UIImage * scaledImageViewImage = [imageViewImagescaleToSize: CGSizeMake (100.0f, 100.

0f)];

[buttonsetImage: scaledButtonImage forState: UIControlStateNormal];

[imageViewsetImage: scaledImageViewImage];

}

- (IBAction) photoButtonPressed {

UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] init];

imagePicker.delegate = selv;

selectingButtonImage = JA ;

[selfpresentModalViewController: imagePicker animerte: YES];

[imagePicker utgivelsen];

}

- (IBAction) selectImageViewImage {

< p> UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] init];

imagePicker.

delegate = selv;

selectingImageViewImage = JA;

[selfpresentModalViewController: imagePicker animerte: YES];

[imagePicker utgivelsen];

}

- (void) imagePickerControllerDidCancel: (UIImagePickerController *) picker {

[selfdismissModalViewControllerAnimated: YES];

}

- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingImage: (UIImage *) selectedImage editingInfo: (NSDictionary *) editingInfo {

if (selectingButtonImage) {

CGSize size = selectedImage.

size;

CGFloat ratio = 0;

if (size.width> size.height) {

ratio = 128,0 /størrelse .width;

} else {

ratio = 130,0 /size.height;

}

CGRect rect = CGRectMake (0,0, 0,0, ratio * size.width, ratio * size.height);

UIGraphicsBeginImageContext (rect.size);

[selectedImage drawInRect:

Page   <<  [1] [2] [3] [4] >>
Copyright © 2008 - 2016 Lese Utdanning Artikler,https://utdanning.nmjjxx.com All rights reserved.