editingview.recipes = oppskrifter;
[self.navigationControllerpushViewController: editingview animerte: YES];
[editingview utgivelsen];
}
else {
[Tableview deselectRowAtIndexPath: indexPath animerte: YES];
}
}
- (UITableViewCellEditingStyle) Tableview: (UITableView *) Tableview editingStyleForRowAtIndexPath: (NSIndexPath *) indexPath {
returnUITableViewCellEditingStyleNone;
}
- (BOOL) Tableview: (UITableView *) Tableview shouldIndentWhileEditingRowAtIndexPath :( NSIndexPath *) indexPath {
returnNO;
}
#pragma mark -
#pragma mark Photo
- (IBAction) photoButtonPressed {
if (self.
editing) {
UIImagePickerController * imagePicker = [[UIImagePickerControlleralloc] init];
imagePicker.delegate = selv;
[selfpresentModalViewController: imagePicker animerte: YES];
[imagePicker utgivelsen];
}
else {
PhotoViewController * Photo = [[PhotoViewControlleralloc] init ];
photoView.recipes = oppskrifter;
[self.
navigationControllerpushViewController: Photo animerte: YES];
[Photo utgivelsen];
}
}
- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingImage: (UIImage *) selectedImage editingInfo: (NSDictionary *) editingInfo {
NSManagedObject * oldImage = oppskrifter. recipeImage;
if (oldImage = null) {
[recipes.managedObjectContextdeleteObject: oldImage];
}
RecipeImage * image = [NSEntityDescriptioninsertNewObjectForEntityForName:@"RecipeImage"inManagedObjectContext:recipes.
managedObjectContext];
recipes.recipeImage = Image;
[image SetValue: selectedImage Forkey: @ "recipeImage"];
CGSize size = selectedImage.size;
CGFloat ratio = 0;
< p> if (size.width> size.height) {
ratio = 128,0 /size.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: rect];
recipes.
recipeThumbnailImage = UIGraphicsGetImageFromCurrentImageContext ();
[selfdismissModalViewControllerAnimated: YES];
}
NET - C # - Bruke UserControls Mail …