资源描述:
《iOS代码--检索_计算机软件及应用_IT计算机_专业资料》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、importUlKitclassGameController:UlViewController,UlCollectionViewDelegate,UICollectionViewDataSource,UlTextFieldDelegate{internalvarimageArray:[Ullmage]!internalvarimage:Ullmage!internalvarcount:Int!varemptyCell:GameViewCell?varstepValue:Int?=0vartimer:NSTimer!vartime:Int
2、?=0varname:String?varnewlmageArray:[Ullmage]!@IBOutletweakvargamelmageView:UlCollectionView!@IBOutletweakvarfulllmageView:UllmageView!@IBOutletweakvarviewFlowLayout:UICollectionViewFlowLayout!@IBOutletweakvartimeLabel:UlLabel!@IBOutletweakvarstepLabel:UlLabel!@IBOutletwe
3、akvartopConstraint:NSLayoutConstraint!@IBActionfuncclickSetButton(sender:UIButton){dismissViewControllerAnimated(true,completion:nil)}@IBActionfuncclickRestartButton(sender:UlButton){timer.invalidate()time=0timer=NSTimer.scheduledTimerWithTimelnterval(1,target:self,selec
4、tor:#selector(creatTime),userinfo:nil,repeats:true)timer.fire()stepLabel.text=String(O)stepValue=0newlmageArray=changeArrayOrder(imageArray)gamelmageView.reloadData()overridefuncviewDidLoad(){super.viewDidLoad()fulllmageView.image=imagenewImageArray=changeArrayOrder(imag
5、eArray)gamelmageView.dataSource=selfgamelmageView.delegate=selftopConstraint.constant=(view.frame.size.width==CGFIoat(320)?10:50)letimageWidth=CGFIoat(gamelmageView.frame.width-CGFIoat(count!)-1)/CGFIoat(count!)viewFlowLayout.itemSize=CGSize(width:imageWidth,height:image
6、Width)}overridefuncviewWillAppear(animated:Bool){super.viewWillAppear(animated)timer=NSTimer.scheduledTimerWithTimelnterval(1,target:self,selector:#selector(creatTime),userinfo:nil,repeats:true)timer.fire()}overridefuncviewWillDisappear(animated:Bool){super.viewWillDisap
7、pear(animated)timer.invalidate()}funccollectionView(collectionView:UlCollectionView,numberOfltemsInSectionsection:Int)・>lnt{returnimageArray!.countfunccollectionView(collectionView:UlCollectionView,cellForltemAtlndexPathindexPath:NSIndexPath)->UICollectionViewCell{letcel
8、l=collectionView.dequeueReusableCellWithReuseldentifier(,,gameCeir,,forlndexPath:indexPath)as!GameViewC