English 中文(简体)
UIPageView 主计长最后一页弹跳效果?
原标题:UIPageViewController last page bounce effect?

我正使用 UIPageViewcurrent 来翻翻内容的多页,而当用户翻翻到 UIPageViewcurrent 最后一页时,我什么也不做,因为没有其他页面可以切换,我怎样才能实现滚动到 UIScrollView 结尾的反弹效果,这样它就能给用户一些反馈,那就是序列的结束?

问题回答

试试这个!

  1. Add an empty page before your first page (and optionally set it to be hidden)
  2. After you have made the setup for your UIPageViewController, manually go to the second page, your first page.
  3. In the pageViewController:viewControllerBeforeViewController: delegate method, check if the view will be the empty page. If so,
    1. manually go to the second page again, maybe after some delay. Or
    2. In some sort of way, disable the UIPanGestureRecognizer in your UIPageViewController

This may not be the perfect solution, but hopefully acceptable. I m also going to do something like this later, so I ll maybe explain more then and try it out myself. Good luck!


//Edit

如果你想最后取得反弹效果(我建议你同时这样做),

  1. Skip this.
  2. Add an extra (or two if you have an odd number of pages and double-sided view) empty page(s) after all your other pages (and optionally set it/them to be hidden)
  3. In the pageViewController:viewControllerAfterViewController: delegate method, check if the view will be the (last) empty page. If so,
    1. manually go to the previous page, maybe after some delay. Or
    2. In some sort of way, disable the UIPanGestureRecognizer in your UIPageViewController

在 (3) 中, 如果您没有禁用 UITapGestureRecognizeer, 您将不得不决定是否是自动手势, 然后选择( 3 1), 其它选择( 3. 2) 路线!





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签