像在通讯录应用程序中一样在 iPhone 中编辑视图
在联系人应用程序中,当您单击导航栏右侧的“编辑”按钮时,视图将动态地自行更改,以允许用户编辑各种内容。
除了正在发生的其他很酷的动画内容之外,我真正感兴趣的是底部的“删除联系人”按钮,该按钮在编辑模式下出现,在点击完成或取消时消失。
你如何实现这种东西?谢谢。
PS:相关问题创建类似于联系人应用程序的编辑视图并且 iPhone 联系人应用的详细信息视图是如何实现的 不会切掉它。
In Contacts application when you click on "Edit" button on the right side of the navbar, view will dynamically change it self in order to allow user edit various stuff.
Besides other cool animated stuff that is going on, what I am really interested in though is the bottom "Delete Contact" button which appears when in edit mode and disappears when done or cancel is tapped.
How do you implement this kind of stuff? Thanks.
P.S.: related questions Create an Edit view similar to Contacts App and How is iPhone Contact app's detail View implemented won't cut it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 BOOL 来跟踪是否处于编辑模式。然后,当按下编辑按钮时切换状态。
对于删除按钮,您可以做的是将其显示在视图中,但在用户编辑之前隐藏,然后在编辑完成后再次隐藏它。对于动画,当编辑 BOOL 更改时,可以在 UIView 动画块中更改淡入淡出的帧和 alpha。
You need to keep track of if you are in editing mode or not with a BOOL. Then when the edit button is pressed toggle the state.
For a delete button what you can do is have it in your view but hidden until the user is editing, and then when done editing hide it again. For animation change the frame and alpha for fading however you like in an UIView animation block when the editing BOOL changes.