Corona中文站

强大、易学的跨平台(iOS/Android)开发框架。QQ群1:74390406(满) 群2:221929599

导航

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

}

CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"myImage.png"]];
myImage.opaque = YES; // explicitly opaque for performance
[self.view addSubview:myImage];
[myImage release];
<< 在Xcode中安装部署及使用JSON.framework(附代码示例)iphone从一个图片截取部分区域生成新的小图 >>

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最近发表

Powered By Z-Blog 1.8 Walle Build 100427 Copyright 2011-2015 BuildApp.Net. All Rights Reserved.