Collection TableView with Drag & Drop - kirseia/study GitHub Wiki
cell reorder ์ ํ๊ณ
์ผ๋ฐ์ ์ผ๋ก CollectionView๋ tableview ๋ด๋ถ์์ cell ์์ ๋ณ๊ฒฝ์ ์๋ ๋ฐฉ์์ ์ฐ๋ฉด ๊ฐ๋จํ๊ฒ ๊ตฌํ์ด ๊ฐ๋ฅํ๋ค. https://www.ioscreator.com/tutorials/reorder-collection-view-cells-ios-tutorial
ํ์ง๋ง, collectionView๋ tableView์ ์์ญ์ ๋ฒ์ด๋๋ฉด ๋์์ ํ์ง ์๋๋ค. ๋ด๊ฐ ํ๋ ค๊ณ ํ๋๊ฑด collectionView / tableView์ cell์ ์์ง์ฌ์ ๋ค๋ฅธ ๋ทฐ ์์ญ๊ณผ ๊ฒน์น๋ฉด ํน์ ๋์์ ์ฒ๋ฆฌํ๋ ๊ฑฐ์๋๋ฐ, ํด๋น ๋ทฐ ์์ญ์ ๋ฒ์ด๋๋๊น ๋์์ ํ์ง ์์์.
tableview / collectionview ๋ผ๋ฆฌ ๋๋ ๋ค๋ฅธ ์ฑ๊ณผ์ drag and drop ์ฒ๋ฆฌ
์ 2๊ฐ์ง ์ฝ๋์์ ๋ณด๋ฉด dragDelegate / dropDelegate ๊ตฌํ์ ํตํด์ ํด๋น ์ฌํญ์ ์ฒ๋ฆฌํ ์ ์๊ฒ ๋๋ค. UIDragItem์ ์ด์ฉํด์ ํด๋น ๋ทฐ๋ฅผ ๋ฒ์ด๋ ์์ญ์์๋ ๋ญ๊ฐ๋ฅผ ํ ์ ์๊ฒ ๋จ
drag ๋นํ๋(?) ๊ณณ์์๋ drag delegate ๋ฅผ ๊ตฌํํ๊ณ , drop ๋นํ๋ ๊ณณ์์๋ drop delegate ๋ฅผ ๊ตฌํํ๋ฉด ๋จ
tableview / collectionview ๊ฐ ์๋๋ผ ๋ฐ๋ก drag / drop item ์ ๊ตฌํํ๋ ๊ฒ
์๋ ์ฝ๋๋ฅผ ์ฐธ๊ณ ํ๋ฉด ๋ ๊ฒ ๊ฐ์๋ฐ ํด๋ณด์ง ์์์. ๋์ค์ ์๊ฐ ๋๋ฉด ํด๋ด์ผ๊ฒ ์.