zoukankan      html  css  js  c++  java
  • ios 初体验<UIButton 控件>

    1.创建UIButton 跟其他方式不同,不是直接alloc,init 创建 用工厂化方式创建

      UIButton *sureBtn = [UIButton buttonWithType:UIButtonTypeSystem];//选择Button 的样式 系统给定的

    //按钮的位置

        sureBtn.frame = CGRectMake(60, 600, 300, 30);

        //设在按钮背景颜色

        sureBtn.backgroundColor = [UIColor blueColor];    

        //设置按钮正常状态的文字

        [sureBtn setTitle:@"点击了" forState:UIControlStateNormal];

        //设置正常状态的颜色

        [sureBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

        //按钮选中状态

        [sureBtn setTitle:@"被点击了" forState:UIControlStateSelected];

        [sureBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

         // 设置圆角的半径

        sureBtn.layer.cornerRadius = 10;

        sureBtn.clipsToBounds = YES;

        // 按钮所要做的事件

        [sureBtn addTarget:self action:@selector(sureButtonPressed:) forControlEvents:UIControlEventTouchUpInside];

        //添加到视图控制区

        [self.view addSubview:sureBtn];

     

     

  • 相关阅读:
    C# treeView添加节点 删除节点
    xml 基础
    第一章魔兽窗口
    混合开发的框架的初步见解
    node.js的初步见解
    AngularJs的理解
    jquery属性,遍历,HTML操作
    jquery中动画效果的函数
    jquery的选择器
    js操作DOM对象及怎么获取浏览器宽高
  • 原文地址:https://www.cnblogs.com/tanglie/p/6438148.html
Copyright © 2011-2022 走看看