Note that there are some explanatory texts on larger screens.

plurals
  1. POResolution changed after saving a image using CoreData
    primarykey
    data
    text
    <p>I have the following code below. Firstly, in the table detail view, i capture or load a image(the size of the image is about 1/4 of the screen), then after saving the image will be shown at the UITableView. Everything seems going well so far. However, when i press the UITable and try to load the detail page again. The resolution of the image becomes lowered. I guess is the same size as the one at the TableView. May I know what can i do in order to fix this problem? </p> <p>Thanks.</p> <pre><code> -(void) ViewDidLoad{ if ([currentPicture smallPicture]) [imageField setImage:[UIImage imageWithData:[currentPicture smallPicture]]]; } - (IBAction)editSaveButtonPressed:(id)sender { // If we are adding a new picture (because we didnt pass one from the table) then create an entry if (!currentPicture) self.currentPicture = (Pictures *)[NSEntityDescription insertNewObjectForEntityForName:@"Pictures" inManagedObjectContext:self.managedObjectContext]; if (imageField.image) // Resize and save a smaller version for the table float resize = 74.0; float actualWidth = imageField.image.size.width; float actualHeight = imageField.image.size.height; float divBy, newWidth, newHeight; if (actualWidth &gt; actualHeight) { divBy = (actualWidth / resize); newWidth = resize; newHeight = (actualHeight / divBy); } else { divBy = (actualHeight / resize); newWidth = (actualWidth / divBy); newHeight = resize; } CGRect rect = CGRectMake(0.0, 0.0, newWidth, newHeight); UIGraphicsBeginImageContext(rect.size); [imageField.image drawInRect:rect]; UIImage *smallImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // Save the small image version NSData *smallImageData = UIImageJPEGRepresentation(smallImage, 1.0); [self.currentPicture setSmallPicture:smallImageData]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload