editingview.recipes = reseptejä;
[self.navigationControllerpushViewController: editingview animoitu: YES];
[editingview release];
}
else {
[taulukkonäkymää deselectRowAtIndexPath: indexPath animoitu: YES];
}
}
- (UITableViewCellEditingStyle) taulukkonäkymää: (UITableView *) taulukkonäkymää editingStyleForRowAtIndexPath: (NSIndexPath *) indexPath {
returnUITableViewCellEditingStyleNone;
}
- (BOOL) taulukkonäkymää: (UITableView *) taulukkonäkymää shouldIndentWhileEditingRowAtIndexPath :( NSIndexPath *) indexPath {
returnNO;
}
# pragma Mark -
# pragma merkki Valokuva
- (IBAction) photoButtonPressed {
jos (self.
editing) {
UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] init];
imagePicker.delegate = itse;
[selfpresentModalViewController: imagePicker animoitu: YES];
[imagePicker release];
}
else {
PhotoViewController * PhotoView = [[PhotoViewControlleralloc] init ];
photoView.recipes = reseptejä;
[self.
navigationControllerpushViewController: PhotoView animoitu: YES];
[PhotoView release];
}
}
- (void) imagePickerController: (UIImagePickerController *) Picker didFinishPickingImage: (UIImage *) selectedImage editingInfo: (NSDictionary *) editingInfo {
NSManagedObject * oldImage = reseptejä. recipeImage;
jos (oldImage! = nolla) {
[recipes.managedObjectContextdeleteObject: oldImage];
}
RecipeImage * kuva = [NSEntityDescriptioninsertNewObjectForEntityForName:@"RecipeImage"inManagedObjectContext:recipes.
managedObjectContext];
recipes.recipeImage = Image;
[kuva SetValue: selectedImage forKey: @ "recipeImage"];
CGSize size = selectedImage.size;
CGFloat suhde = 0;
< p> jos (size.width> size.height) {
suhde = 128,0 /size.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];
recipes.
recipeThumbnailImage = UIGraphicsGetImageFromCurrentImageContext ();
[selfdismissModalV
net Käyttäjän Control