Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-20-2012, 04:09 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 2
coolthing76 is on a distinguished road
Default [cell imageView] in UITableView doesn't appear until selected

Hi,

I have a problem when trying to set the image for the [cell imageView] in a UITableView from the asset library.

The image is loaded but it doesn't appear in the cell until I touch (select) that cell. Here is my code that sets the imageView of the cell:

Code:
{
    NSLog(@"photo loaded from assets library");
    //testing ALAssestLibrary
    ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init];

    ALAssetsLibraryAssetForURLResultBlock resultsBlock = ^(ALAsset *asset)
    {
        ALAssetRepresentation *representation = [asset defaultRepresentation];
        CGImageRef imageRef = [representation fullResolutionImage]; 
        UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];


        [[cell imageView] setImage:[image imageByScalingAndCroppingForSize:CGSizeMake(36.0, 42.0)]];     

        [image release];
    };
    ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError *error){

        NSLog(@"FAILED! due to error in domain %@ with error code %d", error.domain, error.code);
        // This sample will abort since a shipping product MUST do something besides logging a
        // message. A real app needs to inform the user appropriately.
        abort();
    };        

    //Convert path to an NSUrl
    NSURL *url = [NSURL URLWithString:path];


    // Get the asset for the asset URL to create a screen image.
    [assetsLibrary assetForURL:url resultBlock:resultsBlock failureBlock:failureBlock];
    // Release the assets library now that we are done with it.
    [assetsLibrary release]; 



}
The above code is part of the:
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath *)indexPath
Any ideas?
coolthing76 is offline   Reply With Quote
Reply

Bookmarks

Tags
assetslibrary, cell, imageview, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 406
11 members and 395 guests
7twenty7, Atatator, FrankWeller, glenn_sayers, guusleijsten, iphonedevshani, MAMN84, QuantumDoja, Sami Gh, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0