代码添加按钮和按钮监听方法
来源:互联网 发布:淘宝api 生成淘口令 编辑:程序博客网 时间:2024/06/14 00:15
//// ViewController.m// buttonTest//// Created by 殷东亮 on 14-8-31.// Copyright (c) 2014年 easec. All rights reserved.//#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)tapButton:(UIButton *)sender{ NSLog(@"我是%@",[sender.titleLabel text]);}- (void)viewDidLoad{ [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setFrame:CGRectMake(100, 100, 200, 200)]; [button setTitle:@"hello" forState:UIControlStateNormal]; [button setTitle:@"world" forState:UIControlStateHighlighted]; [button setTitleColor:[UIColor greenColor] forState:UIControlStateNormal]; [button setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted]; [button addTarget:self action:@selector(tapButton:) forControlEvents:UIControlEventTouchUpInside]; [button setBounds:CGRectMake(200, 200, 200, 200)]; [button setBackgroundColor:[UIColor grayColor]]; UIImage *image = [UIImage imageNamed:@"photo/12.png"]; [button setBackgroundImage:image forState:UIControlStateNormal]; [self.view addSubview:button]; }- (void)didReceiveMemoryWarning{ [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end
0 0
- 代码添加按钮和按钮监听方法
- 为按钮添加监听事件,监听方法不能用private
- 按钮的监听和touch方法
- java按钮监听方法
- 为按钮添加监听事件
- 安卓按钮添加监听的三种方法
- iOS学习之动态添加Button和监听UIAlertView按钮
- iOS学习之动态添加Button和监听UIAlertView按钮
- iOS学习之动态添加Button和监听UIAlertView按钮
- iOS学习之动态添加Button和监听UIAlertView按钮
- 返回按钮和目录按钮的监听
- 按钮监听
- 按钮方法示例代码
- Ext Js 添加 按钮 监听事件
- 【Unity】代码实现NGUI按钮监听功能
- IOS项目笔记——按钮属性和代码添加
- MFC用代码添加对话框背景图片和按钮图片
- IOS开发基础—利用代码添加按钮和文本框
- fragment的onCreateOptionMenu()
- LeetCode 63 Minimum Path Sum
- 新浪微博ios客户端 开发流程
- Python演绎的精彩故事(一)
- 二叉树(1)已知某2种排序方式,创建这个二叉树并按第3种方式排序
- 代码添加按钮和按钮监听方法
- RailsCasts15 Fun with Find Conditions find中的查询条件
- leetcode系列(4)Evaluate Reverse Polish Notation
- [资源下载] expect 相关学习资料
- hdu-1297(找规律+大数加法)
- 回溯法——集合求子集
- 九度_题目1389:变态跳台阶
- 为活着买单
- poj2823