-pie can only be used when targeting iOS 4.2 or later
code1错误.项目build Settings ->Levels ->iOS Deployment Target 修改成4.2以上
lable.textAlignment = NSTextAlignmentCenter;新的居中方法,不会报警
Swift 3.0给按钮加横线
let attributedStr = NSMutableAttributedString.init(string: titleArr[i])
let range = NSRange.init(location: 0, length: attributedStr.length)
attributedStr.addAttribute(NSUnderlineStyleAttributeName, value: NSNumber.init(value:0x01), range: range)
btn.setAttributedTitle(attributedStr, for: .normal)
//Swift 3.0筛选数组元素为字典某个键的字典,全部加入到另一个数组中
self.picArr = self.postArr.filter({
return Array($0.keys).contains("pic")
})
//Xcode 8.1 clean不管用的时候需要删除工程缓存
直接删除DeriveData
操作步骤是关闭当前项目,然后关闭Xcode,然后通过Terminal或者是Finder找到下面的目录:
~/Library/Developer/XCode/DerivedData
///UIView的增长动画
let view = UIView.init(frame: CGRect.init(x: 10, y: 10, width: 0, height: 30))
view.backgroundColor = UIColor.red
self.view.addSubview(view)
UIView.animate(withDuration: 2) {
view.frame = CGRect.init(x: 10, y: 10, width: 100, height: 30)
}
let pathAnimation = CABasicAnimation.init(keyPath: "strokeEnd")
pathAnimation.duration = 1
pathAnimation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseOut)
pathAnimation.fromValue = 0
pathAnimation.toValue = 1
shapeLayer.add(pathAnimation, forKey: "strokeEndAnimation")