开发者

iPhone: sliding view in and out by pulling an image down from the top

I'm trying to get a UIViewController (B) to appear over a current UIViewController / UITableViewController (A) by pulling down an image which will reveal B f开发者_高级运维rom the top of the screen.

Just below the navigation bar will be an image which is placed on top of A and the user can pull the image down to a certain position revealing a bit of B and then the image and B will animate down to a certain position on the screen, revealing the B's UIViewController / UITableViewController. I've including 2 drawings below hopefully clearing it up better?

First screen: User can pull down the image from the top revealing B as user pulls the image down http://www.petermumford.com/screen1.jpg Second screen: B is now revealed by the image sliding down after reaching its certain pull down position http://www.petermumford.com/screen2.jpg

Can anyone point me in the right direction if this is possible? Any feedback is greatly appreciated.


just to lay down a couple of tips; firstly, yeah, this is totally possible with some not-too-complex dealings with UIView animations and touch handling methods.

Look into the following touch handling methods to create the 'drag down' code for the UIImageView. You will find them under the UIResponder Class Reference. Using these methods, you will be able to move the view of the top viewcontroller up and down with the users finger drag.

– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesCancelled:withEvent:

Look up UIView animations on how you can automatically 'drop' the front viewController to the bottom. You'll find them under the UIView Class Reference. It could be simple as changing the frame of that particular view within a beginAnimations: block.

Note: Ensure that the self.view of the UIViewController A is above the self.view of the UIViewController B, so that when controller A moves away, controller B will be visible underneath automatically.


If you are developing this app for the public it would not be wise to do a gesture like this. It directly conflicts with the notification system tray in iOS5


You can't have an iPhone UIViewController (B) that only covers part of the screen. You could pull down an image as part of A but you can't have B in the middle of the screen with A showing behind it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜