`

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

 
阅读更多

 

- (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];

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics