ios UIView animateWithDuration 学习
来源:互联网 发布:手机通讯录编辑软件 编辑:程序博客网 时间:2024/05/16 15:07
以下代码实现的效果:下滑到某一高度后自动隐藏掉
原始效果1
原始效果2 慢慢的下滑
原始效果3 隐藏消失
#pragma mark -- UIView animateWithDuration- (void)initTestBtn{ _testBtn = [[UIButton alloc]initWithFrame:CGRectMake(15, 230, kDEVICEWIDTH-30, 45)]; _testBtn.backgroundColor = [UIColor grayColor]; [_testBtn addTarget:self action:@selector(commitClick) forControlEvents:UIControlEventTouchUpInside]; [_testBtn setTitle:@"提交" forState:UIControlStateNormal]; _testBtn.titleLabel.textColor = [UIColor whiteColor]; _testBtn.layer.cornerRadius = 4; [self.view addSubview:_testBtn]; // _testView = [[UIView alloc]initWithFrame:CGRectMake(15, 300, kDEVICEWIDTH-30, 45)];// _testView.backgroundColor = [UIColor grayColor];// // [self.view addSubview:_testView]; // [_testView addSubview:_testBtn];}- (void)testAnimateWithDuration{ /*typeof(self) 是获取到self的类型,这样定义出的weakSelf就是和self一个类型的, 加上__weak是建立一个若引用,整句就是给self定义了一个若引用性质的替身; 这个一般用在使用block时会用到,因为block会copy它内部的变量,可能会造成引用循环,使用__weak性质的self替代self,可以切断block对self的引用,避免循环引用*/ __weak __typeof(self) weakSelf = self; CGRect _tempCG = _testBtn.frame; _tempCG.origin.y = 360; [UIView animateWithDuration:1.5 animations:^{ //_testBtn.frame = CGRectMake(15, kDEVICEHEIGHT, kDEVICEWIDTH-30, 45); _testBtn.frame = _tempCG; } completion:^(BOOL finished) { _testBtn.hidden = YES; }];}
0 0
- ios UIView animateWithDuration 学习
- iOS UIView animateWithDuration 使用详解
- iOS- 动画UIView animateWithDuration 使用
- UIView animateWithDuration
- UIView animateWithDuration
- IOS开发笔记UIView使用animateWithDuration控制页面效果
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration 使用详解
- UIView animateWithDuration:animation:completion
- 服务器管理(GIT,GERRIT,SVN)
- swift 2.0 结构体
- 使用netDxf将ArcGIS空间数据按指定样式导出CAD文件
- eclipse中的debug
- 70周年纪念币兑换
- ios UIView animateWithDuration 学习
- Error starting static Resources 问题
- git 使用
- SQL BETWEEN 操作符 高级教程
- qt4-x11-4.8.5 全部的环境变量
- oracle连接mssql
- 与其走的快,不如放慢脚步让自己走的稳,走的好!
- Audio Capture with DirectShow
- 模型v&w