当前位置:  编程技术>移动开发
本页文章导读:
    ▪sdk3.2手势范例        sdk3.2手势实例 #import <UIKit/UIKit.h>@interface GesturesViewController : UIViewController {IBOutlet UIImageView *imageView;}@property (nonatomic, retain) UIImageView *imageView;@end       #import “GesturesViewController.h”@implementa.........
    ▪ 手机市场助理        手机市场助手   手机市场助手   供各位开发者查看自己上传到手机市场上的软件审核情况,软件下载情况等信息。 目前支持机锋网、亿优、爱米、N多网、AppChina应用汇、安卓市场Hiapk、友盟.........
    ▪ 如其你不想分手,想一直走一辈子,那么.       如果你不想分手,想一直走一辈子,那么...... 两个人在一起久了,好多年。感情已经很稳定、彼此了解、不会分手,觉得已经是家人、是亲人了。因为这样的稳定,而忽略了生活上的细节,从.........

[1]sdk3.2手势范例
    来源: 互联网  发布时间: 2014-02-18
sdk3.2手势实例

#import <UIKit/UIKit.h>
@interface GesturesViewController : UIViewController {
IBOutlet UIImageView *imageView;
}
@property (nonatomic, retain) UIImageView *imageView;
@end

 

 

 

#import “GesturesViewController.h”
@implementation GesturesViewController
@synthesize imageView;

 

CGFloat lastScaleFactor = 1;

CGFloat netRotation;

CGPoint netTranslation;

NSArray *images;
int imageIndex = 0;

 


- (void)viewDidLoad {

 


//---tap gesture---
UITapGestureRecognizer *tapGesture =[[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleTapGesture:)];
tapGesture.numberOfTapsRequired = 2;
[imageView addGestureRecognizer:tapGesture];
[tapGesture release];

 

//---pinch gesture---
UIPinchGestureRecognizer *pinchGesture =[[UIPinchGestureRecognizer alloc]
initWithTarget:self
action:@selector(handlePinchGesture:)];
[imageView addGestureRecognizer:pinchGesture];
[pinchGesture release];

 

//---rotate gesture---
UIRotationGestureRecognizer *rotateGesture =
[[UIRotationGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleRotateGesture:)];
[imageView addGestureRecognizer:rotateGesture];
[rotateGesture release];

 

//---pan gesture---
UIPanGestureRecognizer *panGesture =
[[UIPanGestureRecognizer alloc]
initWithTarget:self
action:@selector(handlePanGesture:)];
[imageView addGestureRecognizer:panGesture];
[panGesture release];

 

//---swipe gesture---
images = [[NSArray alloc] initWithObjects:@“architecture.jpg”,
@“Buildings.jpeg”,
@“Bridge.jpeg”, nil];
//---right swipe (default)---
UISwipeGestureRecognizer *swipeGesture =
[[UISwipeGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleSwipeGesture:)];
[imageView addGestureRecognizer:swipeGesture];
[swipeGesture release];
//---left swipe---
UISwipeGestureRecognizer *swipeLeftGesture =
[[UISwipeGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleSwipeGesture:)];
swipeLeftGesture.direction = UISwipeGestureRecognizerDirectionLeft;

 

[imageView addGestureRecognizer:swipeLeftGesture];
[swipeLeftGesture release];

 

 //---long press gesture---
UILongPressGestureRecognizer *longpressGesture =
[[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleLongpressGesture:)];
longpressGesture.minimumPressDuration = 1;
longpressGesture.allowableMovement = 15;
longpressGesture.numberOfTouchesRequired = 1;
[imageView addGestureRecognizer:longpressGesture];
[longpressGesture release];


[super viewDidLoad];
}

 


//---handle tap gesture---
-(IBAction) handleTapGesture:(UIGestureRecognizer *) sender {
if (sender.view.contentMode == UIViewContentModeScaleAspectFit)
sender.view.contentMode = UIViewContentModeCenter;
else
sender.view.contentMode = UIViewContentModeScaleAspectFit;
}

 

//---handle pinch gesture---
-(IBAction) handlePinchGesture:(UIGestureRecognizer *) sender {
CGFloat factor = [(UIPinchGestureRecognizer *) sender scale];
if (factor > 1) {
//---zooming in---
sender.view.transform = CGAffineTransformMakeScale(
lastScaleFactor + (factor-1),
lastScaleFactor + (factor-1));
} else {
//---zooming out---
sender.view.transform = CGAffineTransformMakeScale(
lastScaleFactor * factor,
lastScaleFactor * factor);
}
if (sender.state == UIGestureRecognizerStateEnded){
if (factor > 1) {
lastScaleFactor += (factor-1);
} else {
lastScaleFactor *= factor;
}
}
}

 

 

//---handle rotate gesture---
-(IBAction) handleRotateGesture:(UIGestureRecognizer *) sender {
CGFloat rotation = [(UIRotationGestureRecognizer *) sender rotation];
CGAffineTransform transform = CGAffineTransformMakeRotation(
rotation + netRotation);
sender.view.transform = transform;
if (sender.state == UIGestureRecognizerStateEnded){
netRotation += rotation;
}
}

 

 

//---handle pan gesture---
-(IBAction) handlePanGesture:(UIGestureRecognizer *) sender {
CGPoint translation = [(UIPanGestureRecognizer *) sender translationInView:imageView];
sender.view.transform = CGAffineTransformMakeTranslation(
netTranslation.x + translation.x,
netTranslation.y + translation.y);
if (sender.state == UIGestureRecognizerStateEnded){
netTranslation.x += translation.x;
netTranslation.y += translation.y;
}
}

 

 

//---handle swipe gesture---
-(IBAction) handleSwipeGesture:(UIGestureRecognizer *) sender {
UISwipeGestureRecognizerDirection direction =
[(UISwipeGestureRecognizer *) sender direction];
switch (direction) {
case UISwipeGestureRecognizerDirectionUp:
NSLog(@“up”);
break;
case UISwipeGestureRecognizerDirectionDown:
NSLog(@“down”);
break;
case UISwipeGestureRecognizerDirectionLeft:
imageIndex++;
break;
case UISwipeGestureRecognizerDirectionRight:
imageIndex--;
break;
default:
break;
}
imageIndex = (imageIndex < 0) ? ([images count] - 1):
imageIndex % [images count];
imageView.image = [UIImage imageNamed:[images objectAtIndex:imageIndex]];
}

 

 //---handle long press gesture---
-(IBAction) handleLongpressGesture:(UIGestureRecognizer *) sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@“Image options”
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:@“Save Image”,
@“Copy”, nil];
//---remember to implement the UIActionSheetDelegate protocol in your
// view controller---
[actionSheet showInView:self.view];
[actionSheet release];
}

 


- (void)dealloc {
[imageView release];
[super dealloc];
}


    
[2] 手机市场助理
    来源: 互联网  发布时间: 2014-02-18
手机市场助手

 

手机市场助手

 

供各位开发者查看自己上传到手机市场上的软件审核情况,软件下载情况等信息。

目前支持机锋网、亿优、爱米、N多网、AppChina应用汇、安卓市场Hiapk、友盟...


    
[3] 如其你不想分手,想一直走一辈子,那么.
    来源: 互联网  发布时间: 2014-02-18
如果你不想分手,想一直走一辈子,那么......

两个人在一起久了,好多年。感情已经很稳定、彼此了解、不会分手,觉得已经是家人、是亲人了。因为这样的稳定,而忽略了生活上的细节,从而忽略了对方的感觉。就算再坚固的感情,也会受伤、也会被别人趁虚而入的。所以,我们要注意这些小节,因为生活就是由每个小节组成的。如果你不想分手,想一直走一辈子,那么《情侣必看》可以助你一臂之力。

 


    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3