TimOliver / TOPasscodeViewController

A modal passcode input and validation view controller for iOS
MIT License
385 stars 96 forks source link

Allow custom keypad button border and lettering presence #21

Closed MacroYau closed 6 years ago

MacroYau commented 6 years ago

This PR adds two optional parameters to TOPasscodeViewController for controlling the presence of the border and the "ABC" lettering of the keypad circular buttons. I hope this can increase the UI design flexibility (and avoid being rejected by App Store).

custom_border_letering

The sample app has also been updated to demonstrate the new feature.

TimOliver commented 6 years ago

Thanks for the PR @MacroYau! I love the look of the keypad view without lettering!

However, removing the stroke looks pretty bad. I'm not sure if you can see it, but I disabled anti-aliasing on the inner circle, and removing the stroke makes the edge jagginess visible. This would need to be re-thought a bit more.

The setting to remove the lettering is excellent though. Can we keep just that for now?

On a sidenote, I'm not sure how effective trying to pre-emptively modify the design of this controller to help avoid App Store rejection is. I feel like that as long as you customize the title text and (Once I get to it) add an icon view, it's probably distinct enough then.

MacroYau commented 6 years ago

Thanks for the comments @TimOliver!

Yes, I am aware of the disabled anti-aliasing parameter. I tried to re-enable it in my own build and it seems working quite nicely. What was your original purpose for setting it to NO?

Anyway, I will revert to a no-lettering-only version so you can consider merging that first.

TimOliver commented 6 years ago

No problems! :D

I disabled the anti-aliasing mainly for the very small performance gain it would yield. I knew that the circle was going to be overlaid on top of the stroke graphic since the UIVisualEffectView just goes off the final alpha value of all of the subviews layered together. The circle is intentionally slightly smaller than the stroke circle, so that jagged edge is blended in with the stroke.

In the end, it's probably fine to re-enable anti-aliasing. The circle graphic is re-used amongst all buttons, so it's probably a very very small hit.

I've been considering adding an option to change that style to that of the borderless full circle type in iOS 11. If the stroke is removed, and then the circle's resting alpha value is something like 0.2, that would probably replicate the effect pretty closely.

But then again, that would bring the visual style far closer to the current official one, which might make it more prone to App Store rejection.

Cool! Yeah that would be great for now! Let me have a think about borderless buttons for a bit. I know a few other libraries have rolled their own borderless buttons, but I think they made the font a lot bolder to compensate.

MacroYau commented 6 years ago

@TimOliver So I close this PR for now, and the said revert is created separately in #25.