当前位置: 代码迷 >> Iphone >> iPhone高速参考:显示本地的图片
  详细解决方案

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

热度:34   发布时间:2016-04-25 06:28:21.0
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];

}

  相关解决方案