iOS学习应用开发就业课_004:UIButton时间处理
2016-05-31 11:03
519 查看
难点:
1.创建2个UIButton的时间
a按钮:移动View
b按钮:回复位置
2.保证View的移动
复习次数:5次
5月13日
5月16日
5月26日
5月30日
5月31日
源码:
- (void)viewDidLoad
{
[super
viewDidLoad];
UIButton *myBtn1=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
myBtn1.frame=CGRectMake(50,
500, 80,
40);
[myBtn1
setTitle:@"按下移动"
forState:UIControlStateNormal];
[myBtn1
addTarget:self
action:@selector(pressMove)
forControlEvents:UIControlEventTouchUpInside];
[self.view
addSubview:myBtn1];
UIButton *myBtn2=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
myBtn2.frame=CGRectMake(50,
150, 80,
40);
[myBtn2
setTitle:@"按下移动"
forState:UIControlStateNormal];
[myBtn2
addTarget:self
action:@selector(pressRect)
forControlEvents:UIControlEventTouchUpInside];
[self.view
addSubview:myBtn2];
UIView *vc=[[UIView
alloc] initWithFrame:CGRectMake(1,
250,
100, 100)];
vc.backgroundColor=[UIColor
yellowColor];
vc.tag=101;
[self.view
addSubview:vc];
}
-(void)pressMove
{
UIView *vc=[[UIView
alloc]init];
vc=[self.view
viewWithTag:101];
vc.backgroundColor=[UIColor
darkGrayColor];
vc.frame=CGRectMake(vc.frame.origin.x+10,
vc.frame.origin.y+50,
200,
200);
[self.view
addSubview:vc];
}
-(void)pressRect
{
UIView *vc=[[UIView
alloc]init];
vc=[self.view
viewWithTag:101];
vc.frame=CGRectMake(1,
250, 100,
100);
}
1.创建2个UIButton的时间
a按钮:移动View
b按钮:回复位置
2.保证View的移动
复习次数:5次
5月13日
5月16日
5月26日
5月30日
5月31日
源码:
- (void)viewDidLoad
{
[super
viewDidLoad];
UIButton *myBtn1=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
myBtn1.frame=CGRectMake(50,
500, 80,
40);
[myBtn1
setTitle:@"按下移动"
forState:UIControlStateNormal];
[myBtn1
addTarget:self
action:@selector(pressMove)
forControlEvents:UIControlEventTouchUpInside];
[self.view
addSubview:myBtn1];
UIButton *myBtn2=[UIButton
buttonWithType:UIButtonTypeRoundedRect];
myBtn2.frame=CGRectMake(50,
150, 80,
40);
[myBtn2
setTitle:@"按下移动"
forState:UIControlStateNormal];
[myBtn2
addTarget:self
action:@selector(pressRect)
forControlEvents:UIControlEventTouchUpInside];
[self.view
addSubview:myBtn2];
UIView *vc=[[UIView
alloc] initWithFrame:CGRectMake(1,
250,
100, 100)];
vc.backgroundColor=[UIColor
yellowColor];
vc.tag=101;
[self.view
addSubview:vc];
}
-(void)pressMove
{
UIView *vc=[[UIView
alloc]init];
vc=[self.view
viewWithTag:101];
vc.backgroundColor=[UIColor
darkGrayColor];
vc.frame=CGRectMake(vc.frame.origin.x+10,
vc.frame.origin.y+50,
200,
200);
[self.view
addSubview:vc];
}
-(void)pressRect
{
UIView *vc=[[UIView
alloc]init];
vc=[self.view
viewWithTag:101];
vc.frame=CGRectMake(1,
250, 100,
100);
}
相关文章推荐
- 关于Linkedlist 和 ArrayDeque的讨论
- iOS监听UITabBar的Tab点击事件
- 347. Top K Frequent Elements
- iOS自定义UITableViewCell registerNib: 与 registerClass: 的区别
- Mirantis OpenStack Fuel8.0离线安装(MOS8.0本地源)
- iOS学习应用开发就业课_003:UIButton基本功能
- iOS开发:UITableView加载多张照片导致内存上涨的问题
- UITextField点击选中文字
- java.sql.SQLException: Connections could not be acquired from the underlying database!
- C#里System.Data.SQLite中对GUID的处理
- 实现placeholder属性的UITextView
- Mirantis OpenStack Fuel6.0安装使用—Step2
- String,StringBuffer,StringBuilder三者区别
- 两个非常不错的自定义UIAlertView第三方类库
- Android酷炫实用的开源框架(UI框架)
- Mirantis OpenStack Fuel6.0安装使用—Step1
- UE设置编码
- UIView
- UIWindow
- 点击UIViewController任意位置,收起键盘的3种方法