Path 2.0 大部分效果分享
来源:互联网 发布:知之的幸福之家 编辑:程序博客网 时间:2024/06/05 05:33
http://www.cocoachina.com/iphonedev/toolthain/2011/1222/3768.html
源码由论坛会员zgrubby分享
实现了大部分Path 2.0 特效
注(iOS5 only),文章最后有源码下载
tableview添加手势检测代码
- (
void
)awakeFromNib{
UIPanGestureRecognizer* recognizer;
// handleSwipeFrom 是偵測到手势,所要呼叫的方法
recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:
self
action:
@selector
(handlePanFrom:)];
// 不同的 Recognizer 有不同的实体变数
// 例如 SwipeGesture 可以指定方向
// 而 TapGesture 則可以指定次數
//recognizer.direction = UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight;
recognizer.delegate =
self
;
[_tableView addGestureRecognizer:recognizer];
[recognizer release];
}
- (
BOOL
)gestureRecognizerShouldBegin:(UIPanGestureRecognizer *)gestureRecognizer
{
CGPoint translation = [gestureRecognizer translationInView:[[UIApplication sharedApplication] keyWindow]];
// Check for horizontal gesture
if
(sqrt(translation.x * translation.x) / sqrt(translation.y * translation.y) > 1)
{
return
YES
;
}
return
NO
;
}
- (
void
)handlePanFrom:(UIPanGestureRecognizer*)recognizer {
if
(recognizer.state == UIGestureRecognizerStateBegan) {
;
}
else
if
(recognizer.state == UIGestureRecognizerStateChanged) {
CGFloat xOffSet = [recognizer translationInView:[[UIApplication sharedApplication] keyWindow]].x;
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if
(xOffSet < 0) {
[appDelegate makeRightViewVisible];
}
else
if
(xOffSet > 0) {
[appDelegate makeLeftViewVisible];
}
self
.navigationController.view.frame = CGRectMake(xOffSet,
self
.navigationController.view.frame.origin.y,
self
.navigationController.view.frame.size.width,
self
.navigationController.view.frame.size.height);
}
else
if
(recognizer.state == UIGestureRecognizerStateEnded) {
if
(
self
.navigationController.view.frame.origin.x < -kTriggerOffSet)
[
self
moveToLeftSide];
// animate to right side
else
if
(
self
.navigationController.view.frame.origin.x > kTriggerOffSet)
[
self
moveToRightSide];
// reset
else
[
self
restoreViewLocation];
}
}
原帖地址:http://www.cocoachina.com/bbs/read.php?tid=87846
源码下载:
Path2DemoPrj- Path 2.0 大部分效果分享
- Path 2.0 大部分效果分享
- Path 2.0 大部分效果分享
- Path 2.0 大部分效果分享(tableview左右滑动,时间,menu动画),有码
- path效果
- DataGrid的收集,里面有你想要的大部分效果~
- 分享几个CSS3效果
- 分享到效果初步
- js 分享到效果
- path的图片下拉效果
- Android Path Button效果实现
- 仿path首页滑动效果
- 实现path封面下拉效果
- 草稿:修改.bashrc文件PATH变量错误导致系统大部分命令失效
- [经验分享] 分享 图片透明效果
- [资源分享]unity激光效果分享
- 对于现在毕业之后,大部分找不到合适的工作,转行到软件开发(大部分是JAVA)的人来说,分享下自己的经验
- css3 的shake效果,css3抖动窗口 大部分手机浏览器都支持
- 使用log4net的一点体会
- LCD的CPU接口和RGB接口
- JQuery实例扩展,限制输入长度。
- 在与SQL Server建立连接时出现错误
- 枚举 Enum
- Path 2.0 大部分效果分享
- 在CentOS上安装Git
- Android+PHP最佳实践(送源码)
- Oracle GoldenGate安装配置
- 关于页面重构的一些心得
- 程序员的情书
- windows 2003 IIS 发布 WCF + Silverlight 发布过程可能会遇到几个问题的解决方法
- 扩展接口设计模式(一)
- JConsole使用