ITeye博客

iPhone快速参考:显示本地的图片

tiger888 · 2011-03-24 22:50 · 02-手机开发 · 移动开发 · Markdown

- (void)viewDidLoad

{

    NSString *homeDirectoryPath = NSHomeDirectory();

    NSString *imagePath = [homeDirectoryPath stringByAppendingString:@"/graph.png"];

    NSLog(@"Image: %@", imagePath);

    if (![[NSFileManager defaultManager] fileExistsAtPath:imagePath isDirectory:NULL]) 

    {

        UIImageView * myImageView = [[UIImage alloc] initWithContentsOfFile: imagePath];

        //[[NSFileManager defaultManager] createDirectoryAtPath:imagePath attributes:nil];

 

        [self.view addSubview:myImageView];

        [myImageView release];

    }    

    [super viewDidLoad];

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。