几个月前,我写了一个代码,以适应UIImageView
于UIScrollView
以最小的一面,有放大的能力UIImageView
和缩小.此代码在iOS 8中完美运行,但在iOS 9中,它UIImageView
放在UIScrollView
大小错误的内部.以下是不同操作系统上的示例(不介意本地化差异):
iOS 8
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) 假设我有不同状态的对象.状态从0到2.我需要使用NSSortDescriptor以这种方式对它们进行排序:
1
2
0
有什么建议?
我正在尝试使用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还没有构建.我试图建造它们,但我失败了 - 它们仍然是红色的.