IOS手勢(shì)操作(拖動(dòng)、捏合、旋轉(zhuǎn)、點(diǎn)按、長(zhǎng)按、輕掃、自定義)
下面通過(guò)圖文并茂的方式給大家分享下IOS手勢(shì)操作(拖動(dòng)、捏合、旋轉(zhuǎn)、點(diǎn)按、長(zhǎng)按、輕掃、自定義)的相關(guān)內(nèi)容。
1、UIGestureRecognizer 介紹
手勢(shì)識(shí)別在 iOS 中非常重要,他極大地提高了移動(dòng)設(shè)備的使用便捷性。
iOS 系統(tǒng)在 3.2 以后,他提供了一些常用的手勢(shì)(UIGestureRecognizer 的子類),開(kāi)發(fā)者可以直接使用他們進(jìn)行手勢(shì)操作。
UIPanGestureRecognizer(拖動(dòng))
UIPinchGestureRecognizer(捏合)
UIRotationGestureRecognizer(旋轉(zhuǎn))
UITapGestureRecognizer(點(diǎn)按)
UILongPressGestureRecognizer(長(zhǎng)按)
UISwipeGestureRecognizer(輕掃)
另外,可以通過(guò)繼承 UIGestureRecognizer 類,實(shí)現(xiàn)自定義手勢(shì)(手勢(shì)識(shí)別器類)。
PS:自定義手勢(shì)時(shí),需要 #import <UIKit/UIGestureRecognizerSubclass.h>,一般需實(shí)現(xiàn)如下方法:
- (void)reset;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
//以上方法在分類 UIGestureRecognizer (UIGestureRecognizerProtected) 中聲明,更多方法聲明請(qǐng)自行查看
UIGestureRecognizer 的繼承關(guān)系如下:
2、手勢(shì)狀態(tài)
在六種手勢(shì)識(shí)別中,只有一種手勢(shì)是離散型手勢(shì),他就是 UITapGestureRecognizer。
離散型手勢(shì)的特點(diǎn)就是:一旦識(shí)別就無(wú)法取消,而且只會(huì)調(diào)用一次手勢(shì)操作事件(初始化手勢(shì)時(shí)指定的回調(diào)方法)。
換句話說(shuō)其他五種手勢(shì)是連續(xù)型手勢(shì),而連續(xù)型手勢(shì)的特點(diǎn)就是:會(huì)多次調(diào)用手勢(shì)操作事件,而且在連續(xù)手勢(shì)識(shí)別后可以取消手勢(shì)。從下圖可以看出兩者調(diào)用操作事件的次數(shù)是不同的:
手勢(shì)狀態(tài)枚舉如下:
typedef NS_ENUM(NSInteger, UIGestureRecognizerState) {
UIGestureRecognizerStatePossible, // 尚未識(shí)別是何種手勢(shì)操作(但可能已經(jīng)觸發(fā)了觸摸事件),默認(rèn)狀態(tài)
UIGestureRecognizerStateBegan, // 手勢(shì)已經(jīng)開(kāi)始,此時(shí)已經(jīng)被識(shí)別,但是這個(gè)過(guò)程中可能發(fā)生變化,手勢(shì)操作尚未完成
UIGestureRecognizerStateChanged, // 手勢(shì)狀態(tài)發(fā)生轉(zhuǎn)變
UIGestureRecognizerStateEnded, // 手勢(shì)識(shí)別操作完成(此時(shí)已經(jīng)松開(kāi)手指)
UIGestureRecognizerStateCancelled, // 手勢(shì)被取消,恢復(fù)到默認(rèn)狀態(tài)
UIGestureRecognizerStateFailed, // 手勢(shì)識(shí)別失敗,恢復(fù)到默認(rèn)狀態(tài)
UIGestureRecognizerStateRecognized = UIGestureRecognizerStateEnded // 手勢(shì)識(shí)別完成,同UIGestureRecognizerStateEnded
};
對(duì)于離散型手勢(shì) UITapGestureRecgnizer 要么被識(shí)別,要么失敗,點(diǎn)按(假設(shè)點(diǎn)按次數(shù)設(shè)置為1,并且沒(méi)有添加長(zhǎng)按手勢(shì))下去一次不松開(kāi)則此時(shí)什么也不會(huì)發(fā)生,松開(kāi)手指立即識(shí)別并調(diào)用操作事件,并且狀態(tài)為3(已完成)。
但是連續(xù)型手勢(shì)要復(fù)雜一些,就拿旋轉(zhuǎn)手勢(shì)來(lái)說(shuō),如果兩個(gè)手指點(diǎn)下去不做任何操作,此時(shí)并不能識(shí)別手勢(shì)(因?yàn)槲覀冞€沒(méi)旋轉(zhuǎn))但是其實(shí)已經(jīng)觸發(fā)了觸摸開(kāi)始事件,此時(shí)處于狀態(tài)0;如果此時(shí)旋轉(zhuǎn)會(huì)被識(shí)別,也就會(huì)調(diào)用對(duì)應(yīng)的操作事件,同時(shí)狀態(tài)變成1(手勢(shì)開(kāi)始),但是狀態(tài)1只有一瞬間;緊接著狀態(tài)變?yōu)?(因?yàn)槲覀兊男D(zhuǎn)需要持續(xù)一會(huì)),并且重復(fù)調(diào)用操作事件(如果在事件中打印狀態(tài)會(huì)重復(fù)打印2);松開(kāi)手指,此時(shí)狀態(tài)變?yōu)?,并調(diào)用1次操作事件。
3、使用手勢(shì)的步驟
使用手勢(shì)很簡(jiǎn)單,分為三步:
創(chuàng)建手勢(shì)識(shí)別器對(duì)象實(shí)例。創(chuàng)建時(shí),指定一個(gè)回調(diào)方法,當(dāng)手勢(shì)開(kāi)始,改變、或結(jié)束時(shí),執(zhí)行回調(diào)方法。
設(shè)置手勢(shì)識(shí)別器對(duì)象實(shí)例的相關(guān)屬性(可選部分)
添加到需要識(shí)別的 View 中。每個(gè)手勢(shì)只對(duì)應(yīng)一個(gè) View,當(dāng)屏幕觸摸在 View 的邊界內(nèi)時(shí),如果手勢(shì)和預(yù)定的一樣,那就會(huì)執(zhí)行回調(diào)方法。
PS:一個(gè)手勢(shì)只能對(duì)應(yīng)一個(gè) View,但是一個(gè) View 可以有多個(gè)手勢(shì)。建議在真機(jī)上測(cè)試這些手勢(shì),模擬器操作不太方便,可能導(dǎo)致認(rèn)為手勢(shì)失效的情況。(模擬器測(cè)試捏合和旋轉(zhuǎn)手勢(shì)時(shí),按住 option 鍵,再用觸摸板或鼠標(biāo)操作)
4、舉例說(shuō)明
功能描述:
附加到兩個(gè)圖片視圖 UIImageView 的有『拖動(dòng)』、『捏合』、『旋轉(zhuǎn)』、『點(diǎn)按』;
而『輕掃』和『自定義手勢(shì) KMGestureRecognizer』附加在根視圖 UIView 中。
拖動(dòng):進(jìn)行當(dāng)前圖片視圖位置移動(dòng)
捏合:進(jìn)行當(dāng)前圖片視圖縮放
旋轉(zhuǎn):進(jìn)行當(dāng)前圖片視圖角度旋轉(zhuǎn)
點(diǎn)按:雙擊恢復(fù)當(dāng)前圖片視圖的縮放、角度旋轉(zhuǎn)、不透明度
長(zhǎng)按:設(shè)置當(dāng)前圖片視圖的不透明度為0.7
輕掃:左右輕掃設(shè)置兩個(gè)圖片視圖為居中,同時(shí)以垂直居中的特定偏移量定位
自定義手勢(shì):撓癢功能,左右掃動(dòng)共3次或以上,設(shè)置兩個(gè)圖片視圖為居中,同時(shí)以水平居中的特定偏移量定位
效果如下:
KMGestureRecognizer.h #import <UIKit/UIKit.h> typedef NS_ENUM(NSUInteger, Direction) { DirectionUnknown, DirectionLeft, DirectionRight }; @interface KMGestureRecognizer : UIGestureRecognizer @property (assign, nonatomic) NSUInteger tickleCount; //撓癢次數(shù) @property (assign, nonatomic) CGPoint currentTickleStart; //當(dāng)前撓癢開(kāi)始坐標(biāo)位置 @property (assign, nonatomic) Direction lastDirection; //最后一次撓癢方向 @end KMGestureRecognizer.m #import "KMGestureRecognizer.h" #import <UIKit/UIGestureRecognizerSubclass.h> @implementation KMGestureRecognizer #define kMinTickleSpacing 20.0 #define kMaxTickleCount 3 - (void)reset { _tickleCount = 0; _currentTickleStart = CGPointZero; _lastDirection = DirectionUnknown; if (self.state == UIGestureRecognizerStatePossible) { self.state = UIGestureRecognizerStateFailed; } } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; _currentTickleStart = [touch locationInView:self.view]; //設(shè)置當(dāng)前撓癢開(kāi)始坐標(biāo)位置 } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { //『當(dāng)前撓癢開(kāi)始坐標(biāo)位置』和『移動(dòng)后坐標(biāo)位置』進(jìn)行 X 軸值比較,得到是向左還是向右移動(dòng) UITouch *touch = [touches anyObject]; CGPoint tickleEnd = [touch locationInView:self.view]; CGFloat tickleSpacing = tickleEnd.x - _currentTickleStart.x; Direction currentDirection = tickleSpacing < 0 ? DirectionLeft : DirectionRight; //移動(dòng)的 X 軸間距值是否符合要求,足夠大 if (ABS(tickleSpacing) >= kMinTickleSpacing) { //判斷是否有三次不同方向的動(dòng)作,如果有則手勢(shì)結(jié)束,將執(zhí)行回調(diào)方法 if (_lastDirection == DirectionUnknown || (_lastDirection == DirectionLeft && currentDirection == DirectionRight) || (_lastDirection == DirectionRight && currentDirection == DirectionLeft)) { _tickleCount++; _currentTickleStart = tickleEnd; _lastDirection = currentDirection; if (_tickleCount >= kMaxTickleCount && self.state == UIGestureRecognizerStatePossible) { self.state = UIGestureRecognizerStateEnded; //NSLog(@"自定義手勢(shì)成功,將執(zhí)行回調(diào)方法"); } } } } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self reset]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [self reset]; } @end ViewController.h #import <UIKit/UIKit.h> #import "KMGestureRecognizer.h" @interface ViewController : UIViewController @property (strong, nonatomic) UIImageView *imgV; @property (strong, nonatomic) UIImageView *imgV2; @property (strong, nonatomic) KMGestureRecognizer *customGestureRecognizer; @end ViewController.m #import "ViewController.h" @interface ViewController () - (void)handlePan:(UIPanGestureRecognizer *)recognizer; - (void)handlePinch:(UIPinchGestureRecognizer *)recognizer; - (void)handleRotation:(UIRotationGestureRecognizer *)recognizer; - (void)handleTap:(UITapGestureRecognizer *)recognizer; - (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer; - (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer; - (void)handleCustomGestureRecognizer:(KMGestureRecognizer *)recognizer; - (void)bindPan:(UIImageView *)imgVCustom; - (void)bindPinch:(UIImageView *)imgVCustom; - (void)bindRotation:(UIImageView *)imgVCustom; - (void)bindTap:(UIImageView *)imgVCustom; - (void)bindLongPress:(UIImageView *)imgVCustom; - (void)bindSwipe; - (void)bingCustomGestureRecognizer; - (void)layoutUI; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self layoutUI]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - 處理手勢(shì)操作 /** * 處理拖動(dòng)手勢(shì) * * @param recognizer 拖動(dòng)手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handlePan:(UIPanGestureRecognizer *)recognizer { //視圖前置操作 [recognizer.view.superview bringSubviewToFront:recognizer.view]; CGPoint center = recognizer.view.center; CGFloat cornerRadius = recognizer.view.frame.size.width / 2; CGPoint translation = [recognizer translationInView:self.view]; //NSLog(@"%@", NSStringFromCGPoint(translation)); recognizer.view.center = CGPointMake(center.x + translation.x, center.y + translation.y); [recognizer setTranslation:CGPointZero inView:self.view]; if (recognizer.state == UIGestureRecognizerStateEnded) { //計(jì)算速度向量的長(zhǎng)度,當(dāng)他小于200時(shí),滑行會(huì)很短 CGPoint velocity = [recognizer velocityInView:self.view]; CGFloat magnitude = sqrtf((velocity.x * velocity.x) + (velocity.y * velocity.y)); CGFloat slideMult = magnitude / 200; //NSLog(@"magnitude: %f, slideMult: %f", magnitude, slideMult); //e.g. 397.973175, slideMult: 1.989866 //基于速度和速度因素計(jì)算一個(gè)終點(diǎn) float slideFactor = 0.1 * slideMult; CGPoint finalPoint = CGPointMake(center.x + (velocity.x * slideFactor), center.y + (velocity.y * slideFactor)); //限制最?。踓ornerRadius]和最大邊界值[self.view.bounds.size.width - cornerRadius],以免拖動(dòng)出屏幕界限 finalPoint.x = MIN(MAX(finalPoint.x, cornerRadius), self.view.bounds.size.width - cornerRadius); finalPoint.y = MIN(MAX(finalPoint.y, cornerRadius), self.view.bounds.size.height - cornerRadius); //使用 UIView 動(dòng)畫(huà)使 view 滑行到終點(diǎn) [UIView animateWithDuration:slideFactor*2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ recognizer.view.center = finalPoint; } completion:nil]; } } /** * 處理捏合手勢(shì) * * @param recognizer 捏合手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handlePinch:(UIPinchGestureRecognizer *)recognizer { CGFloat scale = recognizer.scale; recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, scale, scale); //在已縮放大小基礎(chǔ)下進(jìn)行累加變化;區(qū)別于:使用 CGAffineTransformMakeScale 方法就是在原大小基礎(chǔ)下進(jìn)行變化 recognizer.scale = 1.0; } /** * 處理旋轉(zhuǎn)手勢(shì) * * @param recognizer 旋轉(zhuǎn)手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handleRotation:(UIRotationGestureRecognizer *)recognizer { recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation); recognizer.rotation = 0.0; } /** * 處理點(diǎn)按手勢(shì) * * @param recognizer 點(diǎn)按手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handleTap:(UITapGestureRecognizer *)recognizer { UIView *view = recognizer.view; view.transform = CGAffineTransformMakeScale(1.0, 1.0); view.transform = CGAffineTransformMakeRotation(0.0); view.alpha = 1.0; } /** * 處理長(zhǎng)按手勢(shì) * * @param recognizer 點(diǎn)按手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer { //長(zhǎng)按的時(shí)候,設(shè)置不透明度為0.7 recognizer.view.alpha = 0.7; } /** * 處理輕掃手勢(shì) * * @param recognizer 輕掃手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer { //代碼塊方式封裝操作方法 void (^positionOperation)() = ^() { CGPoint newPoint = recognizer.view.center; newPoint.y -= 20.0; _imgV.center = newPoint; newPoint.y += 40.0; _imgV2.center = newPoint; }; //根據(jù)輕掃方向,進(jìn)行不同控制 switch (recognizer.direction) { case UISwipeGestureRecognizerDirectionRight: { positionOperation(); break; } case UISwipeGestureRecognizerDirectionLeft: { positionOperation(); break; } case UISwipeGestureRecognizerDirectionUp: { break; } case UISwipeGestureRecognizerDirectionDown: { break; } } } /** * 處理自定義手勢(shì) * * @param recognizer 自定義手勢(shì)識(shí)別器對(duì)象實(shí)例 */ - (void)handleCustomGestureRecognizer:(KMGestureRecognizer *)recognizer { //代碼塊方式封裝操作方法 void (^positionOperation)() = ^() { CGPoint newPoint = recognizer.view.center; newPoint.x -= 20.0; _imgV.center = newPoint; newPoint.x += 40.0; _imgV2.center = newPoint; }; positionOperation(); } #pragma mark - 綁定手勢(shì)操作 /** * 綁定拖動(dòng)手勢(shì) * * @param imgVCustom 綁定到圖片視圖對(duì)象實(shí)例 */ - (void)bindPan:(UIImageView *)imgVCustom { UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; [imgVCustom addGestureRecognizer:recognizer]; } /** * 綁定捏合手勢(shì) * * @param imgVCustom 綁定到圖片視圖對(duì)象實(shí)例 */ - (void)bindPinch:(UIImageView *)imgVCustom { UIPinchGestureRecognizer *recognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; [imgVCustom addGestureRecognizer:recognizer]; //[recognizer requireGestureRecognizerToFail:imgVCustom.gestureRecognizers.firstObject]; } /** * 綁定旋轉(zhuǎn)手勢(shì) * * @param imgVCustom 綁定到圖片視圖對(duì)象實(shí)例 */ - (void)bindRotation:(UIImageView *)imgVCustom { UIRotationGestureRecognizer *recognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotation:)]; [imgVCustom addGestureRecognizer:recognizer]; } /** * 綁定點(diǎn)按手勢(shì) * * @param imgVCustom 綁定到圖片視圖對(duì)象實(shí)例 */ - (void)bindTap:(UIImageView *)imgVCustom { UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; //使用一根手指雙擊時(shí),才觸發(fā)點(diǎn)按手勢(shì)識(shí)別器 recognizer.numberOfTapsRequired = 2; recognizer.numberOfTouchesRequired = 1; [imgVCustom addGestureRecognizer:recognizer]; } /** * 綁定長(zhǎng)按手勢(shì) * * @param imgVCustom 綁定到圖片視圖對(duì)象實(shí)例 */ - (void)bindLongPress:(UIImageView *)imgVCustom { UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)]; recognizer.minimumPressDuration = 0.5; //設(shè)置最小長(zhǎng)按時(shí)間;默認(rèn)為0.5秒 [imgVCustom addGestureRecognizer:recognizer]; } /** * 綁定輕掃手勢(shì);支持四個(gè)方向的輕掃,但是不同的方向要分別定義輕掃手勢(shì) */ - (void)bindSwipe { //向右輕掃手勢(shì) UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; recognizer.direction = UISwipeGestureRecognizerDirectionRight; //設(shè)置輕掃方向;默認(rèn)是 UISwipeGestureRecognizerDirectionRight,即向右輕掃 [self.view addGestureRecognizer:recognizer]; [recognizer requireGestureRecognizerToFail:_customGestureRecognizer]; //設(shè)置以自定義撓癢手勢(shì)優(yōu)先識(shí)別 //向左輕掃手勢(shì) recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; recognizer.direction = UISwipeGestureRecognizerDirectionLeft; [self.view addGestureRecognizer:recognizer]; [recognizer requireGestureRecognizerToFail:_customGestureRecognizer]; //設(shè)置以自定義撓癢手勢(shì)優(yōu)先識(shí)別 } /** * 綁定自定義撓癢手勢(shì);判斷是否有三次不同方向的動(dòng)作,如果有則手勢(shì)結(jié)束,將執(zhí)行回調(diào)方法 */ - (void)bingCustomGestureRecognizer { //當(dāng) recognizer.state 為 UIGestureRecognizerStateEnded 時(shí),才執(zhí)行回調(diào)方法 handleCustomGestureRecognizer: //_customGestureRecognizer = [KMGestureRecognizer new]; _customGestureRecognizer = [[KMGestureRecognizer alloc] initWithTarget:self action:@selector(handleCustomGestureRecognizer:)]; [self.view addGestureRecognizer:_customGestureRecognizer]; } - (void)layoutUI { //圖片視圖 _imgV UIImage *img = [UIImage imageNamed:@"Emoticon_tusiji_icon"]; CGFloat cornerRadius = img.size.width; _imgV = [[UIImageView alloc] initWithImage:img]; _imgV.frame = CGRectMake(20.0, 20.0, cornerRadius * 2, cornerRadius * 2); _imgV.userInteractionEnabled = YES; _imgV.layer.masksToBounds = YES; _imgV.layer.cornerRadius = cornerRadius; _imgV.layer.borderWidth = 2.0; _imgV.layer.borderColor = [UIColor grayColor].CGColor; [self.view addSubview:_imgV]; //圖片視圖 _imgV2 img = [UIImage imageNamed:@"Emoticon_tusiji_icon2"]; cornerRadius = img.size.width; _imgV2 = [[UIImageView alloc] initWithImage:img]; _imgV2.frame = CGRectMake(20.0, 40.0 + _imgV.frame.size.height, cornerRadius * 2, cornerRadius * 2); _imgV2.userInteractionEnabled = YES; _imgV2.layer.masksToBounds = YES; _imgV2.layer.cornerRadius = cornerRadius; _imgV2.layer.borderWidth = 2.0; _imgV2.layer.borderColor = [UIColor orangeColor].CGColor; [self.view addSubview:_imgV2]; [self bindPan:_imgV]; [self bindPinch:_imgV]; [self bindRotation:_imgV]; [self bindTap:_imgV]; [self bindLongPress:_imgV]; [self bindPan:_imgV2]; [self bindPinch:_imgV2]; [self bindRotation:_imgV2]; [self bindTap:_imgV2]; [self bindLongPress:_imgV2]; //為了處理手勢(shì)識(shí)別優(yōu)先級(jí)的問(wèn)題,這里需先綁定自定義撓癢手勢(shì) [self bingCustomGestureRecognizer]; [self bindSwipe]; } @end
以上代碼就是關(guān)于IOS手勢(shì)操作(拖動(dòng)、捏合、旋轉(zhuǎn)、點(diǎn)按、長(zhǎng)按、輕掃、自定義)的詳解,希望對(duì)大家有所幫助。
- ios電子書(shū)翻頁(yè)效果代碼詳解
- iOS實(shí)現(xiàn)翻頁(yè)效果動(dòng)畫(huà)實(shí)例代碼
- iOS圖片界面翻頁(yè)切換效果
- iOS實(shí)現(xiàn)日歷翻頁(yè)動(dòng)畫(huà)
- 實(shí)例講解iOS中的UIPageViewController翻頁(yè)視圖控制器
- iOS開(kāi)發(fā)中使用屏幕旋轉(zhuǎn)功能的相關(guān)方法
- iOS開(kāi)發(fā)中控制屏幕旋轉(zhuǎn)的編寫(xiě)方法小結(jié)
- iOS拍照后圖片自動(dòng)旋轉(zhuǎn)90度的完美解決方法
- iOS漸變圓環(huán)旋轉(zhuǎn)動(dòng)畫(huà)CAShapeLayer CAGradientLayer
- iOS基于CATransition實(shí)現(xiàn)翻頁(yè)、旋轉(zhuǎn)等動(dòng)畫(huà)效果
相關(guān)文章
全面解析iOS中同步請(qǐng)求、異步請(qǐng)求、GET請(qǐng)求、POST請(qǐng)求
通過(guò)本文給大家全面解析了iOS中同步請(qǐng)求、異步請(qǐng)求、GET請(qǐng)求、POST請(qǐng)求,非常不錯(cuò),具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧2016-08-08iOS狀態(tài)欄frame計(jì)算問(wèn)題的實(shí)現(xiàn)
這篇文章主要介紹了iOS狀態(tài)欄frame計(jì)算問(wèn)題的實(shí)現(xiàn),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-06-06iOS 正則表達(dá)式判斷手機(jī)號(hào)碼、固話
本文主要介紹了iOS 正則表達(dá)式判斷手機(jī)號(hào)碼、固話,以及匹配是否是移動(dòng)/聯(lián)通/電信手機(jī)號(hào)的方法。具有很好的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-03-03使用Reachability類判斷iOS設(shè)備的當(dāng)前網(wǎng)絡(luò)連接類型
這篇文章主要介紹了使用Reachability類判斷iOS設(shè)備的當(dāng)前網(wǎng)絡(luò)連接類型,這里開(kāi)發(fā)語(yǔ)言為傳統(tǒng)的Objectice-C,需要的朋友可以參考下2016-02-02IOS 自定義UICollectionView的頭視圖或者尾視圖UICollectionReusableView
這篇文章主要介紹了IOS 自定義UICollectionView的頭視圖或者尾視圖UICollectionReusableView的相關(guān)資料,需要的朋友可以參考下2017-01-01