*   >> Lectura Educación Artículos >> science >> programación

Cambiar el tamaño de un iPhone UIImage

oller

botónsynthesize, imageView, ButtonImage, imageViewImage, selectingButtonImage, selectingImageViewImage;

//Implementar viewDidLoad hacer configuración adicional después de cargar la vista, por lo general a partir de una semilla

- (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) animada {

[superviewWillAppear: animación];

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 = auto;

selectingButtonImage = SI ;

[selfpresentModalViewController: imagePicker animada: YES];

[liberación imagePicker];

}

- (IBAction) selectImageViewImage {

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

imagePicker.

delegate = auto;

selectingImageViewImage = YES;

[selfpresentModalViewController: imagePicker animada: YES];

[liberación imagePicker];

}

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

[selfdismissModalViewControllerAnimated: YES];

}

- (void) imagePickerController: (UIImagePickerController *) didFinishPickingImage selector: (UIImage *) SelectedImage editingInfo: (NSDictionary *) editingInfo {

si (selectingButtonImage) {

Tamaño CGSize = selectedImage.

size;

CGFloat ratio = 0;

si (Tamano.Width> size.height) {

ratio = 128,0 /tamaño .width;

} else {

ratio = 130,0 /size.height;

}

CGRect rect = CGRectMake (0.0, 0.0, relación * Tamano.Width, relación * size.height);

UIGraphicsBeginImageContex

Page   <<  [1] [2] [3] [4] >>
Copyright © 2008 - 2016 Lectura Educación Artículos,https://lectura.nmjjxx.com All rights reserved.