您的位置:首页 > 其它

pathForResource:imgPath

2014-10-30 10:42 134 查看
+(id)createImageView:(CGRect)frame forPath:(NSString *)imgPath{
    
    UIImageView *imageView = [[[UIImageView
alloc] init] autorelease];
    
    imageView.frame = frame;
    
    if (imgPath != nil) {
//        UIImage *img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imgPath ofType:@"png"]];
        UIImage *img = [UIImage
imageNamed:imgPath]; //CYY 发现上边那种方法只能读取到单倍图
        imageView.image = img;
    }
    
    return imageView;
    
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐