开发者

Easy way to build an in-app demo like they do in Convertbot?

I want to make a little in-app demo like Tapbots does in 开发者_运维百科Convertbot. Maybe there is a better solution than mine?

  • make everything programmatically controlable

  • write a huge class with hundreds of performSelector:withObject:afterDelay: calls to control the whole app for the demo

The demo actually only does two things:

  • Simulate touches on controls (i.e. programmatically pressing buttons)

  • Show text message bubbles when appropriate to explain what is going on

How would you do it?


I don't think there is an easy way to accomplish this.

My suggestion would be to create a class that runs a script of actions for you. The script itself could be as simple as an NSArray of objects representing steps in the demo, each with values such as text for a callout bubble, an action/target pairing (for calling selectors), delay, and so forth. Use NSButton setHighlighted: to simulate button presses. Your class then runs through the array of steps to conduct the demo. You could code this directly, or construct the script at runtime from a YAML file (or other file format that you find easy to edit).

I would expect that investing some time in a mechanism like this will make your life a lot easier when it comes time to a) write and b) fine tune your demo, particularly down the road when you want to add features. You don't want to be managing a huge list of hardcoded calls. And you might even be able to re-use the demo-running code on other projects.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜