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

iPhone kjernedata Tutorial Part 2

itingview = [[EditingViewControlleralloc] initWithNibName: @ "EditingViewController" bundle: [NSBundlemainBundle]];

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];

}

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