最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android程序開發(fā)之給背景圖加上移動(dòng)的手勢(shì)

 更新時(shí)間:2016年03月10日 10:12:47   作者:Livia.Chen  
這篇文章主要介紹了Android程序開發(fā)之給背景圖加上移動(dòng)的手勢(shì) 的相關(guān)資料,需要的朋友可以參考下

一,工程圖。


二,效果圖。


三,代碼。

RootViewController.h

#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController
<UIGestureRecognizerDelegate>
@end 

RootViewController.m

#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//增加背景圖
[self addView];
}
#pragma -mark -functions
//背景圖
-(void)addView
{
//紅色的背景圖
UIView *parentView=[[UIView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
parentView.backgroundColor=[UIColor redColor];
[self.view addSubview:parentView];
[parentView setUserInteractionEnabled:YES];
//移動(dòng)的手勢(shì)
UIPanGestureRecognizer *panRcognize=[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
panRcognize.delegate=self;
[panRcognize setEnabled:YES];
[panRcognize delaysTouchesEnded];
[panRcognize cancelsTouchesInView];
[parentView addGestureRecognizer:panRcognize];
}
#pragma UIGestureRecognizer Handles
- (void)handlePan:(UIPanGestureRecognizer *)recognizer {
NSLog(@"--移動(dòng)的手勢(shì)-----");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

以上代碼是有關(guān)Android程序開發(fā)之給背景圖加上移動(dòng)的手勢(shì)的全部內(nèi)容,希望對(duì)大家有所幫助!

相關(guān)文章

最新評(píng)論

合水县| 小金县| 台东县| 金湖县| 镇远县| 汨罗市| 宿州市| 图们市| 柳林县| 阿图什市| 大庆市| 河北省| 宜良县| 鹤峰县| 新疆| 汽车| 昂仁县| 南京市| 湄潭县| 澎湖县| 阳高县| 缙云县| 宁乡县| 武山县| 乾安县| 庄浪县| 海阳市| 六枝特区| 台州市| 汕头市| 拉萨市| 微山县| 吉安市| 本溪| 调兵山市| 右玉县| 丰原市| 安阳市| 潞西市| 金门县| 邛崃市|