Objective-C ,ios,iphone开发基础:自定义控件:Eg: UIButton
来源:互联网 发布:小型图书馆源码 编辑:程序博客网 时间:2024/04/25 22:48
第一步:新建一个工程,在 .h文件中坐如下声明:
#import <UIKit/UIKit.h>@interface MyButtonViewController : UIViewController{ UIButton* myButton; }@property (nonatomic,retain)UIButton *myButton;
在. m 文件中
#import "MyButtonViewController.h"@interface MyButtonViewController ()@end@implementation MyButtonViewController@synthesize myLable,topic,form,contentField,contentLable,contentSwitch,myButton;- (void)viewDidLoad{ //创建自定义控件,代码实现 CGRect frame = CGRectMake(105.0f, 150.0f, 100.0f, 50.0f); //位置 myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //初始化 [myButton setTitle:@"Click here" forState:normal]; //设置标题以及其他属性 myButton.frame = frame; [self.view addSubview:self.myButton]; //将UIButton 添加在视图上。
[super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.}- (void)viewDidUnload{ [super viewDidUnload]; // Release any retained subviews of the main view.}- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } else { return YES; }}-(void) dealloc{ [myButton release]; [super dealloc];}
//实现键盘隐藏:-(IBAction)resignResponder{ [topic resignFirstResponder]; [form resignFirstResponder];}
- Objective-C ,ios,iphone开发基础:自定义控件:Eg: UIButton
- iOS开发基础控件--UIButton
- Objective-C ,ios,iphone开发基础:协议(protocol)
- Objective-C ,ios,iphone开发基础:几个常用类-NSNumber
- Objective-C ,ios,iphone开发基础:NSDictionary(字典) 和 NSMutableDictionary
- Objective-C ,ios,iphone开发基础:命名规范
- Objective-C ,ios,iphone开发基础:UIAlertView使用详解
- Objective-C ,ios,iphone开发基础:iosMD5大全
- Objective-C ,ios,iphone开发基础:picker控件详解与使用,(实现省市的二级联动)
- iOS开发基础控件--按钮(UIButton)
- Objective-C ,ios,iphone开发基础:3分钟教你做一个iphone手机浏览器
- iphone开发基础之objective-c学习
- Objective-C ,ios,iphone开发基础:ios获取大文件的MD5值
- Objective-C ,ios,iphone开发基础:ios判断图片为png还是jpg或者jepg
- iOS巧用UIButton自定义控件
- 系列:iOS开发-从扩展UIButton到自定义控件
- iOS基础开发-自定义控件
- Objective-C,ios,iphone开发基础:分类(category,又称类别)
- 矩阵算法模板
- xml 转xsd->xsd转c,c++
- 判断两个对象是否是同一个对象 | Equals | ReferenceEquals |== | string 类是一个特殊的类
- Marklogic search development -1.Developing Search Applications in MarkLogic Server
- Ajax长连接
- Objective-C ,ios,iphone开发基础:自定义控件:Eg: UIButton
- HDU_4701_Game
- 实现FusionChart动态获取数据(二)
- 关系模型的基本概念
- N个筛子,掷出M值的可能性
- 2013.8.25
- wikioi p1166 矩阵取数游戏
- 烟台大学acm暑期集训总结
- 谷歌笔试题-背包问题