Is it necessary to test the BOOL finished in a completion handler for UIView animation?

后端 未结 2 721
别跟我提以往
别跟我提以往 2021-01-11 09:36

I\'ve never given any thought to the returned BOOL finished of a UIView animation completion handler, but reading some sample code in the Apple UIView Programmi

2条回答
  •  难免孤独
    2021-01-11 10:10

    Yes you really should honor that bool in your handler. The user might initiate the animation, but before that animation completes normally, the user does something else to cancel it early. This bool well let you know of such cases.

    -- update -- Just to elaborate. Imagine some animation that moves a view across the screen. The handler might fire when the view is done moving. Suppose the user touches somewhere else to cause a new animation that essentially cancels this first one in progress. You could use the provided bool to detect that.

提交回复
热议问题