*   >> lukeminen koulutus Artikkelit >> science >> programming

iPhone Core Data opetusohjelma Osa 2

oller * editingview = [[EditingViewControlleralloc] initWithNibName: @ "EditingViewController" Bundle: [NSBundlemainBundle]];

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

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