Iphone 显示本地的图片

  NSString *homeDirectoryPath = NSHomeDirectory();

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

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

    if (![[NSFileManager defaultManagerfileExistsAtPath:imagePath isDirectory:NULL]) 

    {

        UIImageView * myImageView = [[UIImage allocinitWithContentsOfFile: imagePath];

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

 

        [self.view addSubview:myImageView];

        [myImageView release];

    }    

posted @ 2011-08-31 15:27  老码农豆豆  阅读(537)  评论(0编辑  收藏  举报