//
// ViewController.m
// 07-UIView的常见方法
// #import "ViewController.h" @interface ViewController ()
// 红色的view,通过连线,连线就是把oc代码和UI绑定了。
@property (weak, nonatomic) IBOutlet UIView *redView; /** 红色的view */
@property (nonatomic, weak) UIView *redView1; @property (weak, nonatomic) IBOutlet UIButton *btn1;//这些控件不会死,所以可以用weak,
@property (weak, nonatomic) IBOutlet UIButton *btn2;
@property (weak, nonatomic) IBOutlet UIButton *btn3; @end /**
* 尽量少使用tag:
1> tag的效率非常差
2> tag使用多了,容易乱
*/
@implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; // 根据tag拿到对应的view
UIView *redView = [self.view viewWithTag:];
self.redView = redView; // 1.1 创建UISwitch对象
UISwitch *sw = [[UISwitch alloc] init]; // 1.2 加到控制器的view中
[self.view addSubview:sw]; // 1.3 创建UISwitch对象
UISwitch *sw1 = [[UISwitch alloc] init]; // 1.4 加到红色的view
[redView addSubview:sw1]; // 1.5 创建一个选项卡对象
UISegmentedControl *sg = [[UISegmentedControl alloc] initWithItems:@[@"哈哈哈", @"

ios3--UIView的常见方法的更多相关文章

  1. UIView的常见方法

    - (void)addSubview:(UIView *)view; 添加一个子控件view - (void)removeFromSuperview; 将自己从父控件中移除 - (UIView *)v ...

  2. iOS开发之UIView的常见属性

    1.所有控件都继承自UIView,UIView的常见属性如下: @property(nonatomic,readonly) UIView *superview;获得自己的父控件对象 @property ...

  3. UIPickerView常见属性、常见方法(包括代理方法和数据源方法)的一些说明

    一.UIPickerView 1.UIPickerView的常见属性 // 数据源(用来告诉UIPickerView有多少列多少行) @property(nonatomic,assign) id< ...

  4. UIView的常见属性

    UIView的常见属性: @interface UIView : UIResponder<NSCoding, UIAppearance, UIAppearanceContainer, UIDyn ...

  5. iOS基础--UIView的常见属性

    UIView的常见属性以及方法 @property(nonatomic,readonly) UIView *superview; // 获得自己的父控件对象 @property(nonatomic,r ...

  6. C#图片处理常见方法性能比较

    C#图片处理常见方法性能比较 来自:http://www.cnblogs.com/sndnnlfhvk/archive/2012/02/27/2370643.html   在.NET编程中,由于GDI ...

  7. window对象中的常见方法

    <body><!-- window对象中的常见方法--><script type="text/javascript"> var timeid; ...

  8. python socket 常见方法及 简单服务/客户端

    socket 常见方法: 补充说明:what is file descriptor? 文件描述符是什么? 参考(http://stackoverflow.com/questions/8191905/w ...

  9. VBS操作Excel常见方法

    VBS操作Excel常见方法 作者: 字体:[增加 减小] 类型:转载 时间:2009-11-13我要评论 VBS控制Excel常见方法,需要的朋友可以参考下. dim oExcel,oWb,oShe ...

随机推荐

  1. swift Hashable Equatable

    /// You can use any type that conforms to the `Hashable` protocol in a set or /// as a dictionary ke ...

  2. Springboot + SLF4j + Log4j2 打印异常日志时,耗时要5-6秒

    1.使用jps -l 查看springboot项目的进程ID 2.使用命令jstack -l 进程ID > log.txt 打印堆栈信息到文件,内容如下: "http-nio-8065 ...

  3. laydate.js 月份区间选择插件

    laydate.render({ elem: '#reservation2' , type: 'month' , range: true, //format: '2018/09', theme: '# ...

  4. vue组件---插槽

    (1)插槽内容 Vue 实现了一套内容分发的 API,这套 API 的设计灵感源自 Web Components 规范草案,将 <slot> 元素作为承载分发内容的出口. 在父级组件里可以 ...

  5. Eigen库笔记整理(二)

    Eigen/Geometry 模块提供了各种旋转和平移的表示 旋转矩阵直接使用 Matrix3d 或 Matrix3f Eigen::Matrix3d rotation_matrix = Eigen: ...

  6. Python 操作excel day5

    一.Python操作excel python操作excel使用xlrd.xlwt和xlutils模块 1.xlrd模块是读取excel的: 2.xlwt模块是写excel的: 3.xlutils是用来 ...

  7. linux网络编程——域名转换 gethostbyname与gethostbyaddr

    域名转换 #include <netdb.h> struct hostent *gethostbyname(const char *name); 参数: name: 执行主机名的指针 返回 ...

  8. Python学习-while循环练习

    1.计算1-100的和 i = 1; total = 0; while i <= 100: total = total + i; i = i + 1; print(total); 2.打印出1- ...

  9. 关于vuex自己理解的三幅图

  10. angular中处理多个异步请求的方法汇总

    在实际业务中经常需要等待几个请求完成后再进行下一步操作.但angularjs中$http不支持同步的请求. 解决方法一: $http多层嵌套 $http.get('url1').success(fun ...