加在self.tabbarcontroller.view上的屏保页面拖动效果实现
来源:互联网 发布:怎么执行mysql数据库 编辑:程序博客网 时间:2024/04/30 16:17
需要继承:
UIGestureRecognizerDelegate
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizeralloc] initWithTarget:selfaction:@selector(moveView:)];
panGesture.maximumNumberOfTouches =1;
panGesture.minimumNumberOfTouches =1;
panGesture.cancelsTouchesInView =YES;
panGesture.delegate = self;
[selfaddGestureRecognizer:panGesture];
[panGesture release];
- (void)moveView:(UIPanGestureRecognizer *)gestureRecognizer
{
UIPanGestureRecognizer *pan = (UIPanGestureRecognizer *)gestureRecognizer;
if (pan.state ==UIGestureRecognizerStateBegan) {
CGRect rect = self.frame;
rect.origin.x =0;
self.frame = rect;
}
elseif (pan.state ==UIGestureRecognizerStateChanged) {
CGPoint point = [pan translationInView:self];
// CGRect frame = _screenshotBView.frame;
CGRect frame = self.frame;
frame.origin.x = point.x >0 ? point.x : 0;
self.frame = frame;
}
elseif (pan.state ==UIGestureRecognizerStateEnded || pan.state ==UIGestureRecognizerStateCancelled) {
BOOL x = self.frame.origin.x >self.frame.size.width *kBoundaryWidthRatio;
[UIViewanimateWithDuration:kPushAnimationDurationanimations:^{
CGFloat left = x ? self.frame.size.width :0;
CGRect rect = self.frame;
rect.origin.x = left;
self.frame = rect;
} completion:^(BOOL finished) {
if (x) {
[self removeFromSuperview];
}
}];
}
}
- 加在self.tabbarcontroller.view上的屏保页面拖动效果实现
- 在android4.0中实现View的拖动效果
- OnTouchEvent方法实现View的拖动效果
- iOS 8的scrollView上的试图都不显示(scrollView直接加在带navigation的self.view上
- iPhone 用IB在TabBarController的item上加两个navgationcontroller
- iOS将一个viewcontroller的view加到self.view上
- 转换UITableViewCell在 self.navigationController.view 上的位置
- Android中实现在手机屏幕上拖动View(如拖动图片)(
- Android中实现在手机屏幕上拖动View(如拖动图片)
- 实现页面元素拖动效果的JS函数
- Android夜间模式实现,通过在window上加一层半透明的View
- 自定义view实现图片加影子的效果
- iOS 在其他页面跳转到tabBarController的子控制器
- [iOS/Swift]简单实现跟系统一样的毛玻璃效果的View,可在上面加控件,可移动
- 在网页上实现拖动
- 在Flex中实现可以拖动的毛玻璃效果
- ios加在View上的按钮无响应
- Android View 拖动效果
- iOS集成支付宝SDK支付功能
- 九月的天气是忧郁的,是伤感的,是充满离别的
- 全球97%智能手机采用美国造操作系统
- linux log
- 将Unity3D游戏移植到Android平台上
- 加在self.tabbarcontroller.view上的屏保页面拖动效果实现
- C++构造函数、拷贝构造函数、赋值运算符漫谈(二)——函数返回值
- 在 VMware ESXi 上安装 Minix
- 线程同步的方法 MFC
- Linux sqlite3基本命令
- SDL2.0很多新的修改
- oracle expdp
- JDK中的URLConnection参数详解
- 从std::string转换为LPCWSTR