能不能只用一个pan手势来代替UISwipegesture的各个方向?

 - (void)pan:(UIPanGestureRecognizer *)sender
{ typedef NS_ENUM(NSUInteger, UIPanGestureRecognizerDirection) {
UIPanGestureRecognizerDirectionUndefined,
UIPanGestureRecognizerDirectionUp,
UIPanGestureRecognizerDirectionDown,
UIPanGestureRecognizerDirectionLeft,
UIPanGestureRecognizerDirectionRight
}; static UIPanGestureRecognizerDirection direction = UIPanGestureRecognizerDirectionUndefined; switch (sender.state) { case UIGestureRecognizerStateBegan: { if (direction == UIPanGestureRecognizerDirectionUndefined) { CGPoint velocity = [sender velocityInView:recognizer.view]; BOOL isVerticalGesture = fabs(velocity.y) > fabs(velocity.x); if (isVerticalGesture) {
if (velocity.y > ) {
direction = UIPanGestureRecognizerDirectionDown;
} else {
direction = UIPanGestureRecognizerDirectionUp;
}
} else {
if (velocity.x > ) {
direction = UIPanGestureRecognizerDirectionRight;
} else {
direction = UIPanGestureRecognizerDirectionLeft;
}
}
} break;
} case UIGestureRecognizerStateChanged: {
switch (direction) {
case UIPanGestureRecognizerDirectionUp: {
[self handleUpwardsGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionDown: {
[self handleDownwardsGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionLeft: {
[self handleLeftGesture:sender];
break;
}
case UIPanGestureRecognizerDirectionRight: {
[self handleRightGesture:sender];
break;
}
default: {
break;
}
}
break;
} case UIGestureRecognizerStateEnded: {
direction = UIPanGestureRecognizerDirectionUndefined;
break;
} default:
break;
} }

拉伸图片的时候怎么才能让图片不变形?

 UIImage *image = [[UIImage imageNamed:@"xxx"] stretchableImageWithLeftCapWidth: topCapHeight:];
(刚才有人提醒这个已经deprecated了哈,现在的方法叫resizableImageWithCapInsets).

怎么播放GIF的时候这么卡,有没有好点的库?

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

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

https://github.com/samvermette/SVPullToRefresh

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

怎么把tableview里cell的小对勾的颜色改成别的颜色?

_mTableView.tintColor = [UIColor redColor];

 

本来我的statusbar是lightcontent的,结果用UIImagePickerController会导致我的statusbar的样式变成黑色,怎么办?

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

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

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

怎么改变uitextfield placeholder的颜色和位置?

继承uitextfield,重写这个方法

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

你为什么知道这么多奇怪的花招?

去stackoverflow刷问题啊,少年!

最新文章

  1. 代替jquery $.post 跨域提交数据的N种形式
  2. 整合Spring、SpringMVC、MyBatis
  3. 【CentOS】又是一篇Shell
  4. QT学习(打个广告)
  5. C语言中main函数的参数
  6. (转)CVPR 2016 Visual Tracking Paper Review
  7. php smarty foreach循环注意
  8. media_root以及static_root配置
  9. asp发邮件控件
  10. .net简介(一)
  11. 洛谷p1586四方定理题解
  12. axios 在Vue全局引入的方法
  13. move UVs of a texture
  14. day30 纸牌游戏
  15. SQL Server 中BIT类型字段增删查改那点事
  16. C#安全加密类
  17. FOR XML PATH做为数据表中单列或者多列的字符串拼接的方法,放到一列中去,很好用。
  18. Zigbee系列(路由机制)
  19. 小程序开发总结一:mpvue框架及与小程序原生的混搭开发
  20. Spring在Web应用中使用的原理

热门文章

  1. 【原创】构建高性能ASP.NET站点 第五章—性能调优综述(后篇)
  2. Mybatis之ResultMap一个简短的引论,关联对象
  3. Android 建立View 圆角
  4. Cocos2d-Java安装和配置跨平台游戏引擎以及相关的开发工具
  5. Unity3d 网络编程(三)(Unity3d内置简单的网络server编制)
  6. 网络广告公司的恐慌 XSS广告终结者(html5新特性)
  7. [HAOI2005]路由问题,第二短路
  8. bzoj 2437 [Noi2011]兔子和鸡蛋 [二分图匹配]
  9. HTTPS抓包配置
  10. (札记)Java应用架构设计-模块化模式与OSGi