###前提・実現したいこと
swiftで画像編集の開発を試みているものです。
スタンプを画像に合成する際、スタンプを使った順にCollection Viewのcellを適宜ならべかえる機能が欲しいです。
スタンプはCollection Viewに入れてあります。
どのようなコードを書けばいいいのか見当がつかないので、ヒントやサンプルコードなどをご教授お願いします。
###該当のソースコード
func collectionView(collectionView: UICollectionView, numberOfItemsInSection
section: Int) -> Int {
return stampArray.count } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) let imageView = cell.viewWithTag(1) as! UIImageView imageView.image = stampArray[indexPath.row] return cell; } func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { let delegate = UIApplication.sharedApplication().delegate as! AppDelegate delegate.image = stampArray[indexPath.row] delegate.isStampAdded = true self.dismissViewControllerAnimated(true, completion: nil) } @IBAction func close(sender:AnyObject){ self.dismissViewControllerAnimated(true, completion: nil) } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. }
}
###試したこと
配列の関係かな、と考えてもいます。。。
###補足情報(言語/FW/ツール等のバージョンなど)
swift2.2
Xcode
あなたの回答
tips
プレビュー