English 中文(简体)
在AlAsset图书馆发行
原标题:issue with AlAsset library

Im正面临着与ALAsset图书馆有关的问题: 我有一份有100个图像观点的《统一评论》。 当观看时,就把图像从档案名称中生成功能划出。

这是我的班子:

@interface myClass
{
    NSString *fileName;
    int pathId;
}

viewDidLoad

-(void)viewDidLoad
{
    NSMutableArray *imageCollectionArray = [self createImage:arrayOfmyClassObject];

     //Here I m binding the 100 images in UIView using the images in imageCollectionArray
}

这是我发现问题的方法:

- (NSMutableArray *)createImage:(NSMutableArray *)imageFileNamesArray 
{
    imageArray = [[NSMutableArray alloc] init]; 
    for (int imageNameKey = 0; imageNameKey<100; imageNameKey++) 
    {
         myClass *obj= [imageFileNamesArray objectAtIndex:imageNameKey];
        if(obj.pathId == 0)
        {

            //Here adding the bundle image into the imageArray
                [imageArray addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:obj.fileName ofType:@"png" inDirectory:@"Images"]]];
        }
        else
        {
                typedef void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *asset); typedef void (^ALAssetsLibraryAccessFailureBlock)(NSError *error);
             ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) {
             };
             ALAssetRepresentation *rep = [myasset defaultRepresentation]; 
            CGImageRef iref = [rep fullResolutionImage];
            UIImage *images; 
            if (iref)
                {

            //Here adding the photo library image into the imageArray
             images = [UIImage imageWithCGImage:iref];
            [imageArray addObject:images];

            }
            else
            {
            //Here adding the Nofile.png image into the imageArray if didn t find a photo library image
              images = [UIImage imageNamed:@"Nofile.png"];
             [imageArray addObject:images];
            }

             ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) {

                        //Here adding the Nofile.png image into the imageArray if any failure occurs
                 [imageArray addObject:[UIImage imageNamed:@"Nofile.png"]]; 

            NSLog(@"booya, cant get image - %@",[myerror localizedDescription]);
             };
             NSURL *asseturl = [NSURL URLWithString:obj.fileName];
             ALAssetsLibrary* assetslibrary = [[[ALAssetsLibrary alloc] init] autorelease]; 
            [assetslibrary assetForURL:asseturl
             resultBlock:resultblock failureBlock:failureblock];
        }
    }
    return imageArray;
}

问题是,在我第一次把资产图书馆图像输入时,只展示骨折图像,如果要看另一个观点,然后回到100个图像,就会产生资产形象。 罚款。 问题是同一功能不是在第一负荷产生资产形象。 如何解决这一问题? 提前感谢。

问题回答

与ALAssetLibrary有关的所有方法都不合时宜,因此,你的意见可以在恢复预期数据之前完成负荷周期。 你们必须考虑到这一点,并根据需要重新提出你们的意见(或一部分)。





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签