//Toteuta viewDidLoad tehdä lisää setup lataamisen jälkeen näkymä, tyypillisesti kärki.
- (void) viewDidLoad {
[superviewDidLoad];
selectingButtonImage = EI ;
selectingImageViewImage = EI;
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) animaatio {
[superviewWillAppear: animoitu];
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 = itse;
selectingButtonImage = KYLLÄ ;
[selfpresentModalViewController: imagePicker animoitu: YES];
[imagePicker release];
}
- (IBAction) selectImageViewImage {
< p> UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] init];
imagePicker.
delegate = itse;
selectingImageViewImage = YES;
[selfpresentModalViewController: imagePicker animoitu: KYLLÄ];
[imagePicker release];
}
- (void) imagePickerControllerDidCancel: (UIImagePickerController *) poimija {
[selfdismissModalViewControllerAnimated: KYLLÄ];
}
- (void) imagePickerController: (UIImagePickerController *) Picker didFinishPickingImage: (UIImage *) selectedImage editingInfo: (NSDictionary *) editingInfo {
jos (selectingButtonImage) {
CGSize size = selectedImage.
size;
CGFloat suhde = 0;
jos (size.width> size.height) {
suhde = 128,0 /koko .width;
} else {
suhde = 130,0 /size.height;
}
CGRect rect = CGRectMake (0,0, 0,0, suhde * size.width, suhde * size.height);
UIGraphicsBeginImageContext (rect.size);
[selectedImage drawInRect: RECT];
buttonImage = UIGraphicsGetImageFromCurrentImageContext ();
}
jos (se