//
// 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. Java学习3_一些基础3_16.5.7

    字符串的一些常用方法: int length() String replace(CharSequence oldString,CharSequence newString) 用新字符串代替原字符串,返 ...

  2. Change the color of a link in an NSMutableAttributedString

    Swift Updated for Swift 3 Use with a textView.linkTextAttributes = [NSForegroundColorAttributeName: ...

  3. Angular ZoneJS 原理

    Zone.js到底是如何工作的? 原文链接: blog.kwintenp.com 如果你阅读过关于Angular 2变化检测的资料,那么你很可能听说过zone.Zone是一个从Dart中引入的特性并被 ...

  4. pygame 方块随机飞舞动画

    import pygame import random # default WIDTH=1280 HEIGHT=1060 FPS=60 sum=0 # set color WHITE=(255,255 ...

  5. uva 272 Tex中的引号(Tex Quotes)

    TeX is a typesetting language developed by Donald Knuth. It takes source text together with a few ty ...

  6. Window下的———JDK环境的配置

    1.先把JDK文件解压在一个文件夹里 2.去到 3.具体配置3个 具体按照这样文件路径配置.(CLASSPATH 需要添加一个   . ;加路径    ) 4.最后检验 显示出JDK版本号就表示配置成 ...

  7. JS中遍历EL表达式中后台传过来的Java集合

    前言:在我的项目里有这么一个情况,后台直接model.addAttribute()存储了一个对象,此对象内部有一个集合,前端JSP处理的方法正常情况下就是直接使用EL表达式即可.但是如果在JS中需要使 ...

  8. js之标签操作

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. shoppping collection

    personal shopping collections shop Table of Contents 1. phone network 2. band share 3. Motorcycle He ...

  10. ACM多校联赛7 2018 Multi-University Training Contest 7 1009 Tree

    [题意概述] 给一棵以1为根的树,树上的每个节点有一个ai值,代表它可以传送到自己的ai倍祖先,如果不存在则传送出这棵树.现在询问某个节点传送出这棵树需要多少步. [题解] 其实是把“弹飞绵羊”那道题 ...