按钮,图片,瑞士国旗的升降,手势
来源:互联网 发布:孔老师淘宝美工教程 编辑:程序博客网 时间:2024/04/29 01:31
//
// ViewController.m
// OCGuoQi
//
// Created by apple on 14-7-8.
// Copyright (c) 2014年 apple . All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
{ UIView *redView;
UIButton *button;
int flag;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
redView = [[UIView alloc] init];
redView.frame = CGRectMake(50,400,30,30);
redView.backgroundColor = UIColor.redColor;
[self.view addSubview:redView];
UIView *whiteColor = [[UIView alloc] initWithFrame:(CGRectMake(12,6,6,18))];
whiteColor.backgroundColor = UIColor.whiteColor;
[redView addSubview:whiteColor];
UIView *whitColor = [[UIView alloc] initWithFrame:(CGRectMake(6,12,18,6))];
whitColor.backgroundColor = UIColor.whiteColor;
[redView addSubview:whitColor];
//图片的显示
UIImageView *imageView = [[UIImageView alloc] init];
imageView.frame = CGRectMake(100,200,200,200);
[self.view addSubview:imageView];
[imageView initWithImage:[UIImage imageNamed:@"1"]];
//按钮的创建
button =[UIButton buttonWithType:(UIButtonTypeSystem)];
button.frame = CGRectMake(0,100,50,50);
[button setTitle:@"按钮" forState:UIControlStateNormal];
[button addTarget:self action:@selector(did) forControlEvents: UIControlEventTouchUpInside];
[self.view addSubview:button];
//手势的定义
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
// [tap addTarget:self action:@selector(did)];
// [self.view addGestureRecognizer:tap];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(void)did{
NSLog(@"滴滴");
[UIView animateWithDuration:5 animations:^{
if (flag == 0) {
redView.frame = CGRectMake(50,40,30,30);
flag = 1;
}
else {
redView.frame = CGRectMake(50,400,30,30);
flag = 0;
}
}];
}
@end
// ViewController.m
// OCGuoQi
//
// Created by apple on 14-7-8.
// Copyright (c) 2014年 apple . All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
{ UIView *redView;
UIButton *button;
int flag;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
redView = [[UIView alloc] init];
redView.frame = CGRectMake(50,400,30,30);
redView.backgroundColor = UIColor.redColor;
[self.view addSubview:redView];
UIView *whiteColor = [[UIView alloc] initWithFrame:(CGRectMake(12,6,6,18))];
whiteColor.backgroundColor = UIColor.whiteColor;
[redView addSubview:whiteColor];
UIView *whitColor = [[UIView alloc] initWithFrame:(CGRectMake(6,12,18,6))];
whitColor.backgroundColor = UIColor.whiteColor;
[redView addSubview:whitColor];
//图片的显示
UIImageView *imageView = [[UIImageView alloc] init];
imageView.frame = CGRectMake(100,200,200,200);
[self.view addSubview:imageView];
[imageView initWithImage:[UIImage imageNamed:@"1"]];
//按钮的创建
button =[UIButton buttonWithType:(UIButtonTypeSystem)];
button.frame = CGRectMake(0,100,50,50);
[button setTitle:@"按钮" forState:UIControlStateNormal];
[button addTarget:self action:@selector(did) forControlEvents: UIControlEventTouchUpInside];
[self.view addSubview:button];
//手势的定义
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
// [tap addTarget:self action:@selector(did)];
// [self.view addGestureRecognizer:tap];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
-(void)did{
NSLog(@"滴滴");
[UIView animateWithDuration:5 animations:^{
if (flag == 0) {
redView.frame = CGRectMake(50,40,30,30);
flag = 1;
}
else {
redView.frame = CGRectMake(50,400,30,30);
flag = 0;
}
}];
}
@end
0 0
- 按钮,图片,瑞士国旗的升降,手势
- 升降的文字特殊效果
- 瑞士Kardex(卡迪斯)自动化仓储货柜,Shuttle XP系列升降库驱动监控系统
- libgdx的手势与按钮混用
- UINavigationBar的Back按钮手势失灵解决办法
- 关于百度排名的升降
- python列表的 升降序
- 在imageView依次添加7个手势, 1.点击哪个按钮,往imageView上添加哪个手势.(保证视图上只有一个手势). 2.轻拍:点击视图切换美女图片.(imageView上首先展示的美女
- 改进的图片按钮
- 图片做的按钮
- 图片按钮的实现
- 按钮图片的设置 .
- 特殊的按钮--图片
- MFC的图片按钮
- MFC的图片按钮
- MFC的图片按钮
- MFC的图片按钮
- 手势图片
- JAVA技术交流群
- 平均成绩
- 计算视觉与机器学习类资讯~
- iOS之多线程编程
- dede如何在前台显示会员的登录状态
- 按钮,图片,瑞士国旗的升降,手势
- hadoop1.2.1基本操作整理
- 网站不能访问,但是linux服务器上,没有什么问题(是个小问题,但是小问题,不一定你想的到)
- HttpClient学习整理
- 嵌入式Linux USB WIFI驱动的移植
- C++ Excel
- 1821: [JSOI2010]Group 部落划分 Group (并查集)
- jquery eaayui 学习datagrid
- 2010 Asia Fuzhou Regional Contest POJ 3697 Selecting courses