antiraum / THPinViewController

iOS 7 Style PIN Screen for iPhone and iPad
MIT License
460 stars 103 forks source link

Fixes an issue that caused the cancel button title to be shown briefly b... #17

Closed nilsgrabenhorst closed 9 years ago

nilsgrabenhorst commented 9 years ago

Hi Thomas, The bottom button was briefly showing the cancel title before replacing it with the delete title even when the cancel button is hidden. It's just a small cosmetic issue. Apparently the titles of UIButtons don't update immediately when calling -setTitle:forState:.

I fixed this by having two separate buttons instead, one for deleting and one for cancelling. They are hidden/shown when appropriate. This adds a bit of complexity by having to manage these buttons. That's why I added a new view class that contains the two buttons. On the other hand a bit of complexity is removed by not having to juggle the titles and target/actions.

Cheers, nils

antiraum commented 9 years ago

Thanks for the pull request and sorry for the late reply. However there is a much simpler fix for the issue. The button was created with the wrong type. Changing the button type to UIButtonTypeCustom prevents the flashing (see https://github.com/antiraum/THPinViewController/commit/1574020cebebd2fa7b6d40e619ac2a3816e18912).