UIButton 游戏角色选择到 UIImageView 动画
我的孩子教育应用程序的编码即将结束,哇哦!。
但是……我被某件事困住了。
当应用程序加载时,我有我的主视图。它有 4 个用于翻转视图的按钮(每个按钮有十个内容视图)和 4 个用于角色选择的按钮(一个图像将跟随您浏览每个内容屏幕)。
问题是我不确定如何将 UIButton 选择链接到多个视图中的 UIImage 显示。我希望用户选择一个字符按钮,然后继续转到翻转视图,并且在视图中显示的图像应该是他们在主视图上选择的图像。因此,每次他们返回主视图时,他们都可以更改在应用程序中跟随他们的角色。
任何想法、帮助或代码将不胜感激!
谢谢你
亚历克斯
I am almost at the end of coding my kids educational application, woohoo!.
But... Im stuck on something.
When app loads i have my main view. It has 4 buttons for flipviews(each with ten views of content) and 4 buttons for character selection(an image that will follow you through every screen of content).
Problem is im unsure on how to link UIButton selection to UIImage display in multiple views. I want the user to choose a character button and then continue to the flipviews and in the views the image displayed should be the one that they have selected on the main view. So everytime they return to the main view they can change the character that will follow them around the app.
Any thoughts, help or code would be much appreciated!
Thank You
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个新对象,它是 UIImageView 的子类,它有一个 -setImage 方法。设置图像后,无论您将该对象嵌入到何处,它都会显示相同的图像。您甚至可以让子类视图旁边显示分数、名称或其他统计数据,这样当您从一个屏幕转到另一个屏幕时,所有信息都会随着图像一起显示。无需在所有屏幕中为全局信息创建标签。
总之:
祝你好运!
Make a new object, a subclass of UIImageView, which has a -setImage method. Once you set the image, then where ever you embed that object, it will display the same image. You could even have that subclass view have a score displayed next to it, or a name or other stats, so as you go from one screen to another, you have all that info follow you around with the image. No need to create labels in all the screens for global info like that.
In summary:
Good luck!