【问题标题】:How to load and display local image in Three20如何在 Three20 中加载和显示本地图像
【发布时间】:2011-07-13 09:01:23
【问题描述】:

现在我在 Three20.. 我正在使用两个图像源来加载图像..这意味着

本地文件夹中的一种图像类型。即应用程序文件夹中的图像 其他来自网址.. 我的问题是我不知道如何从本地文件夹加载图像..并显示它...

我的代码如下...

 BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:mpngPath];
    if(fileExists==YES)
    {

        NSLog(@"image is present");

        //load and display??


    }


    else {
        NSLog(@"image is  not present");
              }

【问题讨论】:

    标签: iphone three20 photo-gallery


    【解决方案1】:

    像这样:

    [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"filename" ofType:@"png"]];
    

    【讨论】:

      【解决方案2】:

      将网址替换为您的照片路径。我假设您将图像保存在文档目录中。

       [NSString stringWithFormat:@"documents://%@",yourPhotoName];
      

      【讨论】:

        猜你喜欢
        • 2014-09-18
        • 1970-01-01
        • 2018-03-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-12-06
        • 1970-01-01
        • 2017-05-27
        相关资源
        最近更新 更多