日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iOS开发的一些奇巧淫技2

發(fā)布時(shí)間:2024/4/17 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iOS开发的一些奇巧淫技2 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

能不能只用一個(gè)pan手勢(shì)來代替UISwipegesture的各個(gè)方向?

1 - (void)pan:(UIPanGestureRecognizer *)sender 2 { 3 4 typedef NS_ENUM(NSUInteger, UIPanGestureRecognizerDirection) { 5 UIPanGestureRecognizerDirectionUndefined, 6 UIPanGestureRecognizerDirectionUp, 7 UIPanGestureRecognizerDirectionDown, 8 UIPanGestureRecognizerDirectionLeft, 9 UIPanGestureRecognizerDirectionRight 10 }; 11 12 static UIPanGestureRecognizerDirection direction = UIPanGestureRecognizerDirectionUndefined; 13 14 switch (sender.state) { 15 16 case UIGestureRecognizerStateBegan: { 17 18 if (direction == UIPanGestureRecognizerDirectionUndefined) { 19 20 CGPoint velocity = [sender velocityInView:recognizer.view]; 21 22 BOOL isVerticalGesture = fabs(velocity.y) > fabs(velocity.x); 23 24 if (isVerticalGesture) { 25 if (velocity.y > 0) { 26 direction = UIPanGestureRecognizerDirectionDown; 27 } else { 28 direction = UIPanGestureRecognizerDirectionUp; 29 } 30 } 31 32 else { 33 if (velocity.x > 0) { 34 direction = UIPanGestureRecognizerDirectionRight; 35 } else { 36 direction = UIPanGestureRecognizerDirectionLeft; 37 } 38 } 39 } 40 41 break; 42 } 43 44 case UIGestureRecognizerStateChanged: { 45 switch (direction) { 46 case UIPanGestureRecognizerDirectionUp: { 47 [self handleUpwardsGesture:sender]; 48 break; 49 } 50 case UIPanGestureRecognizerDirectionDown: { 51 [self handleDownwardsGesture:sender]; 52 break; 53 } 54 case UIPanGestureRecognizerDirectionLeft: { 55 [self handleLeftGesture:sender]; 56 break; 57 } 58 case UIPanGestureRecognizerDirectionRight: { 59 [self handleRightGesture:sender]; 60 break; 61 } 62 default: { 63 break; 64 } 65 } 66 break; 67 } 68 69 case UIGestureRecognizerStateEnded: { 70 direction = UIPanGestureRecognizerDirectionUndefined; 71 break; 72 } 73 74 default: 75 break; 76 } 77 78 }

拉伸圖片的時(shí)候怎么才能讓圖片不變形?

1 UIImage *image = [[UIImage imageNamed:@"xxx"] stretchableImageWithLeftCapWidth:10 topCapHeight:10]; 2 (剛才有人提醒這個(gè)已經(jīng)deprecated了哈,現(xiàn)在的方法叫resizableImageWithCapInsets).

?

  • ?

    怎么播放GIF的時(shí)候這么卡,有沒有好點(diǎn)的庫?

    FlipBoard出品的太適合你了。https://github.com/Flipboard/FLAnimatedImage

    怎么一句話添加上拉刷新?

    https://github.com/samvermette/SVPullToRefresh

    1 [tableView addPullToRefreshWithActionHandler:^{ 2 // prepend data to dataSource, insert cells at top of table view 3 // call [tableView.pullToRefreshView stopAnimating] when done 4 } position:SVPullToRefreshPositionBottom];

    怎么把tableview里cell的小對(duì)勾的顏色改成別的顏色?

    _mTableView.tintColor = [UIColor redColor];


    本來我的statusbar是lightcontent的,結(jié)果用UIImagePickerController會(huì)導(dǎo)致我的statusbar的樣式變成黑色,怎么辦?

    1 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; }

    怎么把我的navigationbar弄成透明的而不是帶模糊的效果?

    1 [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationBar.shadowImage = [UIImage new]; self.navigationBar.translucent = YES;

    ?

    怎么改變uitextfield placeholder的顏色和位置?

    繼承uitextfield,重寫這個(gè)方法

    1 - (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blueColor] setFill]; [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment]; }

    ?

    你為什么知道這么多奇怪的花招?

    去stackoverflow刷問題啊,少年!

    轉(zhuǎn)載于:https://www.cnblogs.com/myios/p/4191228.html

    總結(jié)

    以上是生活随笔為你收集整理的iOS开发的一些奇巧淫技2的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。