小编Pau*_*nov的帖子

计算minimumZoomScale的代码在iOS 8和iOS 9上的行为有所不同

几个月前,我写了一个代码,以适应UIImageViewUIScrollView以最小的一面,有放大的能力UIImageView和缩小.此代码在iOS 8中完美运行,但在iOS 9中,它UIImageView放在UIScrollView大小错误的内部.以下是不同操作系统上的示例(不介意本地化差异):

iOS 8

iOS 8的结果

iOS 9

iOS 9的结果

该代码用于计算缩放级别(在Swift中):

let imageRatio = image.size.height / image.size.width
let scrollRatio = scrollView.frame.size.height / scrollView.frame.size.width

if imageRatio > scrollRatio {
    scrollView.minimumZoomScale = scrollView.frame.size.width / image.size.width
}else{
    scrollView.minimumZoomScale = scrollView.frame.size.height / image.size.height
}

if scrollView.minimumZoomScale > 1 {
    scrollView.maximumZoomScale = scrollView.minimumZoomScale
}else{
    scrollView.maximumZoomScale = 1
}

scrollView.zoomScale = scrollView.minimumZoomScale

let x = (scrollView.contentSize.width / 2) - (scrollView.bounds.size.width / 2)
let y = ((scrollView.contentSize.height / 2) - …
Run Code Online (Sandbox Code Playgroud)

scroll image view zoom ios

6
推荐指数
0
解决办法
195
查看次数

非常使用NSSortDescriptor的自定义订单

假设我有不同状态的对象.状态从0到2.我需要使用NSSortDescriptor以这种方式对它们进行排序:

1

2

0

有什么建议?

iphone xcode nssortdescriptor

4
推荐指数
1
解决办法
4370
查看次数

构建SSToolKit和SSOAuthKit的问题

我正在尝试使用SSToolKit和SSOAuthKit构建Sam Soffes的TwitterDemo.我得到6个错误和1个警告.他们来了:

  Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CABasicAnimation", referenced from:
      objc-class-ref in libSSOAuthKit.a(SSAddressBarTextFieldBackgroundView.o)
  "_OBJC_CLASS_$_CAMediaTimingFunction", referenced from:
      objc-class-ref in libSSOAuthKit.a(SSAddressBarTextFieldBackgroundView.o)
  "_kCAMediaTimingFunctionEaseIn", referenced from:
      -[SSAddressBarTextFieldBackgroundView _setupAnimation] in libSSOAuthKit.a(SSAddressBarTextFieldBackgroundView.o)
  "_OBJC_CLASS_$_CAKeyframeAnimation", referenced from:
      objc-class-ref in libSSOAuthKit.a(SSAnimatedImageView.o)
  "_kCAAnimationDiscrete", referenced from:
      -[SSAnimatedImageView _animationWithName:images:repeatCount:delegate:] in libSSOAuthKit.a(SSAnimatedImageView.o)
  "_kCAFillModeForwards", referenced from:
      -[SSAnimatedImageView _animationWithName:images:repeatCount:delegate:] in libSSOAuthKit.a(SSAnimatedImageView.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

并警告:

'UIImage' may not respond to '+imageNamed:bundle:'
Run Code Online (Sandbox Code Playgroud)

我认为问题是libSSToolkit.a和libSSOAuthKit.a还没有构建.我试图建造它们,但我失败了 - 它们仍然是红色的.

static ios sstoolkit

1
推荐指数
1
解决办法
1080
查看次数

标签 统计

ios ×2

image ×1

iphone ×1

nssortdescriptor ×1

scroll ×1

sstoolkit ×1

static ×1

view ×1

xcode ×1

zoom ×1