???????Ч??: ???????????????????????? ??????????????????λ??????????λ??
????1: ???????????
????for _ in 0...49 {
????let cardSet = UIImageView(image: UIImage(named: "cardBackLandscape"))
????self.view.addSubview(cardSet)
????cardSet.frame = self.landscapeCardBack.frame
????self.cardSetList.append(cardSet)
????}
????NSNotificationCenter.defaultCenter().postNotificationName("setCreated"?? object: nil)
????????????????UIImageView???????????????????Щ????в??? ????????????????? ????λ???????????? ????????????setCreated??? ???????????????card set?????????? ????????е????????
????2: ??????????????????????????????????????????????????ζ?????50????????3????????????
?????????delayTime???????????????? ??????????????????
????????????????±??card???????????????????????????????????UIView????????????????????????????????????????????????????????????????????????????????UIViewAnimation????card????????????????POP?????????????????????Basic????.??????????????????????????????????λ?????delayTime????????????????????shuffleFinished????????????????????????????? ????????????????????
????func shuffleTheSet() {
????self.shuffleButton.userInteractionEnabled = false
????let delayTime = dispatch_time(DISPATCH_TIME_NOW?? Int64(0.5 * Double(NSEC_PER_SEC)))
????dispatch_after(delayTime?? dispatch_get_main_queue()) {
????NSNotificationCenter.defaultCenter().postNotificationName("shuffleFinished"?? object: nil)
????}
????for count in 0...49 {
????UIView.animateWithDuration(0.3?? animations: {
????let cardRotateAnimation = POPBasicAnimation(propertyNamed: kPOPLayerRotation)
????cardRotateAnimation.fromValue = 0
????cardRotateAnimation.toValue = CGFloat(M_PI * 2.0)
????cardRotateAnimation.duration = 1
????//                cardRotateAnimation.duration = Double(count>5 ? count/2 : count/10)
????cardRotateAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
????self.cardSetList[count].layer.pop_addAnimation(cardRotateAnimation?? forKey: "cardRotation")
????self.cardSetList[count].frame.origin = CGPointMake(CGFloat(arc4random()) % (250 - 0 + 1) + 0?? CGFloat(arc4random()) % (300 - 74 + 1) + 74)
????self.view.layoutIfNeeded()
????self.landscapeCardBack.removeFromSuperview()
????})
????}
????}
????3: ???????????????λ???????button??title???????????.
????for count in 0...49 {
????UIView.animateWithDuration(0.3?? animations: {
????self.cardSetList[count].center = self.landscapeCardBack.center
????})
????self.view.layoutIfNeeded()
????}
????self.shuffleButton.userInteractionEnabled = true
????self.shuffleButton.setTitle("Cut Card"?? forState: .Normal)