Preamble
Date: Mon Feb 9 12:59:01 PST 2015
近些時(shí)間想要瞭解一些特效Library的原理, 有幸讀到一些很好的文章(附在最後)
1. 單向滑動(dòng)
1.1 截圖方法
設(shè)置兩個(gè)View, MenuView, ContentView.
當(dāng)“左拉” 觸屏發(fā)動(dòng)時(shí)候, 把當(dāng)前ContentView屏幕截屏, 然後將MenuView 顯現(xiàn)出來, 同時(shí)右移ContentView截圖; 當(dāng)“右拉” 觸屏發(fā)動(dòng)時(shí)候, 把MenuView左移, 同時(shí)左移截圖, 然後將ContentView顯現(xiàn)出來.
Pro: 簡單, 容易實(shí)現(xiàn), 省內(nèi)存.
Con: 如果ContentView為動(dòng)態(tài), gif, video, 將無法顯現(xiàn).
1.2.平移方法
設(shè)置兩個(gè)View, MenuView(Left), ContentView(Right).
首先將, 兩個(gè) View 同時(shí)顯現(xiàn)在一排, 如圖

當(dāng)“左拉” 觸屏發(fā)動(dòng)時(shí)候, 同時(shí)右移ContentView, MenuView; 當(dāng)“右拉” 觸屏發(fā)動(dòng)時(shí)候, 同時(shí)左移ContentView, MenuView.
Pros: 更加標(biāo)準(zhǔn), "左拉", "右拉"時(shí)候能夠繼續(xù)展示Content, i.e. gif, video.
Cons: 兩個(gè)View一直存在.
2. 雙向滑動(dòng)
三個(gè)Views, LeftView, MainView, RightView.
LeftView, RightView 為隱藏, 當(dāng)“左拉”, 向左偏移MainView; 當(dāng)“右拉” 觸屏發(fā)動(dòng)時(shí)候, 向右偏移MainView.
Reference
Libraries
https://github.com/gotosleep/JASidePanels
https://github.com/mikefrederick/mfsidemenu
https://github.com/SocialObjects-Software/AMSlideMenu
https://github.com/aryaxt/iOS-Slide-Menu