iOS显示一张图片 Objective-C
2024-08-30 16:54:50
图片文件放在项目目录下
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// [self.view addSubview:];]
NSString *path = [[NSBundle mainBundle] pathForResource:@"snow" ofType:@"jpg"]; UIImage *image = [UIImage imageWithContentsOfFile:path];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[imageView setFrame:CGRectMake(, , image.size.width, image.size.height)];
[self.view addSubview:imageView];
// self.imageview.image = image; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
最新文章
- 【XLL 框架库函数】 TempActiveRow/TempActiveRow12
- Effective Objective-C 2.0 — 第12条:理解消息转发机制
- VTK初学一,e_Triangle三角形的绘制
- ASP.NET Web API 数据验证
- 如何通过阅读C标准来解决C语言语法问题
- 安装Ubuntu14.04版本的操作系统
- 基于selenium的pyse自动化测试框架
- 在Jena框架下基于MySQL数据库实现本体的存取操作
- 3244: [Noi2013]树的计数 - BZOJ
- web开发工具类
- 在.Net中进行跨线程的控件操作(下篇:BackgroundWorker)
- mysql 分区表详解
- treeview树形菜单,递归
- Paint获取Text的宽和高的数据
- INFORMATION_SCHEMA.PROFILING
- 前端性能核对表Checklist-2018
- JavaScript基础函数---李老师的
- 洛谷P3959 宝藏
- kickstart-E
- CSS布局学习(三) - position属性定义及解释(官网直译)
热门文章
- FTP指令说明
- Java循环中删除一个列表元素
- linux系统的开机流程
- 改动Centosserver主机名称
- react组件是怎么来的
- openstack页面自己定义插件使用具体解释(django、ajax、post)(zTree为例)
- MongoDB升级导致启动失败
- 破碎纪念---记第二次Nexus4换屏
- Write a program that gives count of common characters presented in an array of strings..(or array of
- Codeforces Round #322 (Div. 2) D. Three Logos 模拟