UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cy.png"]];
// 加载后会缓存图片
UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageWithContentsOfFile:@"cy.png"]];
// 加载后不会缓存图片
本文介绍了两种UIImageView初始化方式:一种会缓存图片,另一种则不会。通过对比,帮助开发者理解不同初始化方法的区别及其应用场景。
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cy.png"]];
// 加载后会缓存图片
UIImageView *imageView = [[UIImageView alloc] initWithImage: [UIImage imageWithContentsOfFile:@"cy.png"]];
// 加载后不会缓存图片
3万+

被折叠的 条评论
为什么被折叠?