Autoscrolling the UIscrollview [duplicate]

2019-09-02 02:09发布

问题:

This question already has an answer here:

  • Autoscrolling in a UIScrollview 3 answers

I have already asked the same question a few time but I have had no answer.

I would like to know if someone can help me get a UIScrollview to autoscroll down the page with an incrementally faster speeds.

I also have buttons on the page. It would also be great when the user touches a button on the page it keeps autoscrolling. So if you kind of understand it will be like the game Piano Tiles.

I am running Xcode 5. If someone has the solution to my problem please can you tell me what code goes where as I am quite a newby Xcode.

Your help will be greatly appreciated.:)

回答1:

I suspect the Piano Tiles game is actually using something like Sprite Kit.

This allows a lot more control over thing like "scrolling" speed.

Instead of using a UIScrollView you would use an SKNode as a layer with the buttons added to that parent layer.

Then using the update game loop you can incrementally increase the speed of the movement based on the time since the game started.

In essence... don't use UIScrollView, don't use UIKit, use SpriteKit.