需求是: by default是全屏显示web view,然后在点了某个按钮后,list view就会作为left panel出现(show with animation from left),当点击非list view area就会隐藏该list view。
没具体研究,先写下可能的方案
方法1: 使用popover component,不过它只能用在ipad里,有人实现了iphone version
方法2:通过animation来实现uiview的隐藏和显示 (http://www.vellios.com/2010/07/11/simple-iphone-animation-tutorial/),该例子是使用button来show and hide,我们可以在uiview里添加一个left arrow来指示user click it to hide uiview。但怎样使得点非该控件的区域来隐藏呢? 是不是要使用 touchesbegan and isfirstresponder?
方法3: 使用modal view,其background使用clearcolor。把list view放到modal view的左边,popup modal view时用context.... style,造成该modal view的右边并没有完全遮住web view透明效果的效果,并试图使user click modal view的right area时就会隐藏该view. (注意: present modal view没有从左到右的animation,要自定义).不过使用context.... style会在旋转时出现modal view旋转但parent view不旋转的情况 :(
参考文档:
animation
http://www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial
http://www.raywenderlich.com/5478/uiview-animation-tutorial-practical-recipes
http://stackoverflow.com/questions/6605959/implement-custom-animation-to-present-modal-view-from-specified-view-on-ipad
http://stackoverflow.com/questions/6780916/iphone-modal-view-animation-help
http://mobiledevelopertips.com/user-interface/sliding-views-on-and-off-screen-creating-a-reusable-sliding-message-widget.html
http://stackoverflow.com/questions/7343915/subview-slide-in-animation-iphone
http://nachbaur.com/blog/core-animation-part-2
touch event
http://esyscn.com/forum.php?mod=viewthread&tid=51232
http://www.cnblogs.com/kuku/archive/2011/11/12/2246389.html
http://stackoverflow.com/questions/1456120/hiding-the-keyboard-when-losing-focus-on-a-uitextview
http://stackoverflow.com/questions/3775577/uiimageview-touch-event
http://yuxiang13115204.blog.163.com/blog/static/2680202220092148354247/
http://blog.csdn.net/gavinming/article/details/7457450
http://stackoverflow.com/questions/4660371/how-to-add-a-touch-event-to-a-uiview