zoukankan      html  css  js  c++  java
  • iOS.UIKit.02.UIButton_UILabel

    图01图01图02图02 图03图03图04图04

    一、案例介绍:点击图01中的Button,Label文本变为“Hello World”,如图02。

    二、案例步骤:

    1、选择Single View Application新建项目,取名cq.39.UIButton_UILabel,如图03。

    2、在Main.storyboard中拖一个UIButton和一个UILabel,如图04。

    3、代码

    #import <UIKit/UIKit.h>
    
    @interface CQ39ViewController : UIViewController
    
    @property (weak,nonatomic) IBOutlet UILabel *label;
    
    - (IBAction)click:(id)sender;
    
    @end
    
    
    
    #import "CQ39ViewController.h"
    
    @interface CQ39ViewController ()
    
    @end
    
    @implementation CQ39ViewController
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
    }
    
    - (IBAction)click:(id)sender
    {
        self.label.text = @"Hello World!";
    }
    
    @end

    4、连线,如图05,图06,在连接Button时,选择事件Touch Up InSide,command + r运行。

    图05图05图06图06

  • 相关阅读:
    Linux 基础
    Python 代码片段收藏
    Oracle数据库介绍
    Oracle11g数据库快速安装
    Oracle11g客户端安装配置
    Oracle环境变量
    Oracle数据类型
    Oracle的表
    Oracle事务
    Oracle的where子句
  • 原文地址:https://www.cnblogs.com/cqchen/p/3764112.html
Copyright © 2011-2022 走看看