Fixed some stuff
This commit is contained in:
parent
55b8358321
commit
b67b0e17a4
|
@ -656,9 +656,11 @@ print(myLabel.frame) // (0.0, 0.0, 323.5, 20.0)
|
|||
// There is also fitHeight and fitWidth
|
||||
```
|
||||
|
||||
Easily animate label text change
|
||||
Easily animate label text change:
|
||||
|
||||
``` swift
|
||||
myLabel.setText("*I* am your father!",animated:true)
|
||||
myLabel.setText("I am your father!", animated: true, duration: 0.3)
|
||||
|
||||
```
|
||||
|
||||
##UIImageView Extensions
|
||||
|
|
|
@ -39,7 +39,9 @@ extension Array {
|
|||
}
|
||||
|
||||
extension Array where Element : Equatable {
|
||||
func arrayContainsArray(lookFor:[Element]) -> Bool {
|
||||
|
||||
/// EZSwiftExtensions
|
||||
public func arrayContainsArray(lookFor: [Element]) -> Bool {
|
||||
for item in lookFor {
|
||||
if self.contains(item) == false {
|
||||
return false
|
||||
|
|
|
@ -57,12 +57,12 @@ extension UILabel {
|
|||
sizeToFit()
|
||||
}
|
||||
|
||||
func setText(text:String?,animated:Bool) {
|
||||
/// EZSwiftExtensions
|
||||
public func setText(text: String?, animated: Bool, duration: NSTimeInterval) {
|
||||
if animated {
|
||||
UIView.transitionWithView(self, duration: 0.3, options: .TransitionCrossDissolve, animations: { () -> Void in
|
||||
UIView.transitionWithView(self, duration: duration, options: .TransitionCrossDissolve, animations: { () -> Void in
|
||||
self.text = text
|
||||
}) { (completion) -> Void in
|
||||
}
|
||||
}, completion: nil)
|
||||
} else {
|
||||
self.text = text
|
||||
}
|
||||
|
|
|
@ -509,20 +509,22 @@ extension UIView {
|
|||
}
|
||||
|
||||
extension UIView {
|
||||
|
||||
/// EZSwiftExtensions
|
||||
/**
|
||||
Shakes the view for as many number of times as given in the argument
|
||||
*/
|
||||
func shakeViewForTimes(times:Int) {
|
||||
let anim = CAKeyframeAnimation( keyPath:"transform" )
|
||||
public func shakeViewForTimes(times: Int) {
|
||||
let anim = CAKeyframeAnimation(keyPath: "transform")
|
||||
anim.values = [
|
||||
NSValue( CATransform3D:CATransform3DMakeTranslation(-5, 0, 0 ) ),
|
||||
NSValue( CATransform3D:CATransform3DMakeTranslation( 5, 0, 0 ) )
|
||||
NSValue(CATransform3D: CATransform3DMakeTranslation(-5, 0, 0 )),
|
||||
NSValue(CATransform3D: CATransform3DMakeTranslation( 5, 0, 0 ))
|
||||
]
|
||||
anim.autoreverses = true
|
||||
anim.repeatCount = Float(times)
|
||||
anim.duration = 7/100
|
||||
|
||||
self.layer.addAnimation( anim, forKey:nil)
|
||||
self.layer.addAnimation(anim, forKey: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue