UIImage的一种使用

大多数时候我们使用uiimage时候用

[UIImage imageNamed:@"xxxx.png"];但是这样会创建一个自动释放池,一般用路径来初始化uiimage


UIImage *image=[[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"xxx.png"]];

UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

[self.view insertSubview:imageView atIndex:0];

[image release];


posted @ 2011-07-12 11:48  小菜比  阅读(465)  评论(0编辑  收藏  举报