首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

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

2012-09-22 
iPhone快速参考:显示本地的图片?- (void)viewDidLoad{? ? NSString *homeDirectoryPath NSHomeDirectory

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

}

热点排行