UIView+Extension"推出视图"
2016-06-02 20:37
435 查看
通过“UIView+Extension”来修改视图的的x,y,推出视图
这里“根”视图为UITableView“三问,1答”中,didSelectRowAtIndexPath方法来做
当点中某一行cell时
拿到要获取的控制器的对象,并使cell点击后,变为未选中状态
*//点中即消失
[tableView deselectRowAtIndexPath:indexPath animated:YES];
//数据源
TRMusic *music = self.musicArray[indexPath.row];
TRMusic)
[TRMusicTool setCurrentPlayingMusic:music];
//跳转/显示(修view的y值)
[self.playingViewController showPlayingView];//showPlayView为要推出界面的
在要获取的控制器中声明并实现类方法,调用UIVie*w+Extension的方法。
*#pragma mark – 显示播放视图
- (void)showPlayingView {
//1.获取keyWindow
UIWindow *window = [UIApplication sharedApplication].keyWindow;
//2.view的frame
self.view.frame = window.bounds;
//3.添加到keyWindow上
[window addSubview:self.view];
//设置view的最大y值
self.view.y = window.bounds.size.height;
//4.设置从下到上显示的动画(view.y从最大到0)
[UIView animateWithDuration:1 animations:^{
//y改成0
self.view.y = 0;
}];
}*
//用这个方法推出来的视图,“不会影响其根视图”;
这里“根”视图为UITableView“三问,1答”中,didSelectRowAtIndexPath方法来做
当点中某一行cell时
拿到要获取的控制器的对象,并使cell点击后,变为未选中状态
*//点中即消失
[tableView deselectRowAtIndexPath:indexPath animated:YES];
//数据源
TRMusic *music = self.musicArray[indexPath.row];
TRMusic)
[TRMusicTool setCurrentPlayingMusic:music];
//跳转/显示(修view的y值)
[self.playingViewController showPlayingView];//showPlayView为要推出界面的
在要获取的控制器中声明并实现类方法,调用UIVie*w+Extension的方法。
*#pragma mark – 显示播放视图
- (void)showPlayingView {
//1.获取keyWindow
UIWindow *window = [UIApplication sharedApplication].keyWindow;
//2.view的frame
self.view.frame = window.bounds;
//3.添加到keyWindow上
[window addSubview:self.view];
//设置view的最大y值
self.view.y = window.bounds.size.height;
//4.设置从下到上显示的动画(view.y从最大到0)
[UIView animateWithDuration:1 animations:^{
//y改成0
self.view.y = 0;
}];
}*
//用这个方法推出来的视图,“不会影响其根视图”;
相关文章推荐
- 利用UIGraphics绘制一个会走的时钟
- 解决Guidline muste specify type方案
- easyUI中文乱码
- leetcode 300. Longest Increasing Subsequence-最长子序列|动态规划
- 触摸UITextView找到该触摸点的文字
- Qt之操作数据库(SQLite) [此博文包含图片] (2013-12-09 16:58:05) 转载 ▼ 标签: qt sqlite qsqldatabase qsqlquery qsqlerro
- NGUI制作流光效果
- NGUI组件整理总结
- UIView与CALayer
- Build Your Own Lisp chapter4的小错误 error: editline/history.h: No such file or directory的解决
- iOS UITableView+FDTemplateLayoutCell 配合AutoLayout分分钟教你实现动态高度自适应
- 【UGUI实战】游戏右上角CoinBar的自动调整
- UIView Class Reference
- Android UI
- UITableViewCellAccessoryType
- Scala Java Error: value filter is not a member of *
- JSP中Out和Request对象详解
- ueditor浏览器 无法上传文件.问题
- build-helper-maven-plugin插件
- require与require.async区别