IOS UI 手写 UIImageView
来源:互联网 发布:centos coreos 编辑:程序博客网 时间:2024/05/16 01:25
@implementation MainViewController- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //UIImaageView 初始化方法 UIImageView *Banner = [[UIImageView alloc]init]; Banner.image = [UIImage imageNamed:@"banner.jpg"]; //UIImaageView 属性-------------------------------------------------------------------------------------- //UIImaageView 圆角属性 Banner.layer.masksToBounds = YES; Banner.layer.cornerRadius = 10; //UIImaageView 设置边框色和大小 Banner.layer.borderColor = [UIColor redColor].CGColor; Banner.layer.borderWidth = 2; //UIImaageView 设置显示或隐藏 Banner.hidden = NO; //UIImaageView 设置图片透明度 alpha Banner.alpha = 1; Banner.tag = 100; //UIViewContentModeScaleToFill 拉伸自适应比例 //UIViewContentModeScaleAspectFit 不拉伸自适应比例 //UIViewContentModeBottom 填充底部 //UIViewContentModeRedraw 尺寸改变时重绘 //UIViewContentModeCenter 填充中间 //UIViewContentModeTop 填充顶部 //UIViewContentModeLeft 中间贴左 //UIViewContentModeRight 中间贴右 //UIViewContentModeTopLeft 贴左上 //UIViewContentModeTopRight 贴右上 //UIViewContentModeBottomLeft 贴左下 //UIViewContentModeBottomRight 贴右下 Banner.contentMode = UIViewContentModeScaleToFill; //Banner.contentMode = UIViewContentModeScaleAspectFit; //Banner.contentMode = UIViewContentModeBottom; //Banner.contentMode = UIViewContentModeRedraw; //Banner.contentMode = UIViewContentModeCenter; //Banner.contentMode = UIViewContentModeTop; //Banner.contentMode = UIViewContentModeLeft; //Banner.contentMode = UIViewContentModeRight; //Banner.contentMode = UIViewContentModeTopLeft; //Banner.contentMode = UIViewContentModeTopRight; //Banner.contentMode = UIViewContentModeBottomLeft; //Banner.contentMode = UIViewContentModeBottomRight; // imageview 的用户交互 Banner.userInteractionEnabled = YES; // 创建单击手势 初始化 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(haha:)]; //控件添加手势 [Banner addGestureRecognizer:tap]; // 设置 高亮状态 图片 Banner.highlightedImage = [UIImage imageNamed:@"2.jpg"]; //给初始化完的UIImaageView定位置和宽高 Banner.frame = CGRectMake(20, 70, 100, 80); //添加按钮进屏幕 [self.view addSubview:Banner]; }// 手势的自定义方法- (void)haha:(UITapGestureRecognizer *)tt{ // 通过tag值 找到对应的控件 (上面的创建的 imageview Banner) UIImageView *ss = (UIImageView *)[self.view viewWithTag:100]; // 设置显示 高亮状态 ss.highlighted = YES;}
0 0
- IOS UI 手写 UIImageView
- IOS UI控件 - UIImageView
- IOS UI 手写 UIButton
- IOS UI 手写UILable
- IOS--UI--LessonUIControl UIImageView/ UISegmentedControl
- iOS -UI-06 UIImageView 动画
- iOS UI篇 学习笔记 UIButton,UIImageView
- [IOS]今天开始学UI---UIImageView
- iOS之UI随笔-UIButton与UIImageView
- iOS系列UI篇——UIImageView
- iOS UI基础控件之UIImageView
- UI-UIImageView
- UI---UIImageView
- iOS开发UI篇—Quartz2D(自定义UIImageView控件)
- UIImageView用法大全 - iOS - UI基础知识总结7
- iOS开发UI高级—37Quartz2D(自定义UIImageView控件)
- iOS中ui单列模式 uibutton和uiimageview 的区别
- iOS开发UI系列之UIImageView的基本使用
- leetcode:Combination Sum 【Java】
- Android Native Crash 堆栈转换
- 树的基本概念
- swift简单学习之类与对象
- Linux "ls -l"文件列表权限详解
- IOS UI 手写 UIImageView
- Oracle学习笔记(五)
- 最大滑动窗口
- 问题描述:星系炸弹
- Java并发编程:synchronized
- 测试
- Activiti工作流节点的自由跳转
- 关于CT图像重建,投影矩阵的产生是基础啊!!!
- S3C2440端口操作函数