程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> C#基本之Lambda表達式用法實例教程

C#基本之Lambda表達式用法實例教程

編輯:C#入門知識

C#基本之Lambda表達式用法實例教程。本站提示廣大學習愛好者:(C#基本之Lambda表達式用法實例教程)文章只能為提供參考,不一定能成為您想要的結果。以下是C#基本之Lambda表達式用法實例教程正文


一,工程圖。


二,後果圖。


三,代碼。

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];
//挪動的手勢
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(@"--挪動的手勢-----");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

以上代碼是有關Android法式開辟之給配景圖加上挪動的手勢的全體內容,願望對年夜家有所贊助!

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved