TOPasscodeViewContentLayout.h 6.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // TOPasscodeViewContentLayout.h
  3. //
  4. // Copyright 2017 Timothy Oliver. All rights reserved.
  5. //
  6. // Permission is hereby granted, free of charge, to any person obtaining a copy
  7. // of this software and associated documentation files (the "Software"), to
  8. // deal in the Software without restriction, including without limitation the
  9. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. // sell copies of the Software, and to permit persons to whom the Software is
  11. // furnished to do so, subject to the following conditions:
  12. //
  13. // The above copyright notice and this permission notice shall be included in
  14. // all copies or substantial portions of the Software.
  15. //
  16. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  21. // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. #import <Foundation/Foundation.h>
  23. #import <UIKit/UIKit.h>
  24. /**
  25. Depending on the width of the application window, all of the content views in
  26. the passcode view need to be resized in order to fit in the available space.
  27. This means that not only does the spacing and sizing of views need to be changed, but
  28. image assets need to be regenerated and font sizes need to change as well.
  29. This class assumes there will be three major screen sizes, and provides layout
  30. sizes, spacing, and styles in order to resize the passcode view for each one.
  31. The three screen styles it supports are:
  32. * Small Screens - iPhone 5/ or iPad 9.7" in 1/4 split screen mode
  33. * Medium Screens - iPhone 6/ or iPad 12.9" in 1/4 split screen mode
  34. * Large Screens - iPhone 6 Plus and all iPads when not in split screen mode.
  35. */
  36. @interface TOPasscodeViewContentLayout : NSObject
  37. /* The width of the PIN view in which this layout object is sizing the content to fit. */
  38. @property (nonatomic, assign) CGFloat viewWidth;
  39. /* Extra padding at the bottom in order to shift the content slightly up */
  40. @property (nonatomic, assign) CGFloat bottomPadding;
  41. /* The title view at the very top */
  42. @property (nonatomic, assign) CGFloat titleViewBottomSpacing; // Space from the bottom of the title view to the title label
  43. /* The Title Label Explaining the Passcode View */
  44. @property (nonatomic, assign) CGFloat titleLabelBottomSpacing; // Space from the title label to the input view
  45. @property (nonatomic, strong) UIFont *titleLabelFont; // The font of the title label
  46. /* Title Label properties when the view is laid out horizontally */
  47. @property (nonatomic, assign) CGFloat titleHorizontalLayoutWidth; // When laid out horizontally, the width of the title view
  48. @property (nonatomic, assign) CGFloat titleHorizontalLayoutSpacing; // The amount of spacing between the title label and the passcode keypad
  49. @property (nonatomic, assign) CGFloat titleViewHorizontalBottomSpacing; // Space from the bottom of the title view when iPhone is horizontal
  50. @property (nonatomic, assign) CGFloat titleLabelHorizontalBottomSpacing; // Spacing from the title label to input view in horizontal mode
  51. /* Circle Row Configuration */
  52. @property (nonatomic, assign) CGFloat circleRowDiameter; // The diameter of each circle representing a PIN number
  53. @property (nonatomic, assign) CGFloat circleRowSpacing; // The spacing between each circle
  54. @property (nonatomic, assign) CGFloat circleRowBottomSpacing; // Space between the view used to indicate input
  55. /* Text Field Configuration */
  56. @property (nonatomic, assign) CGFloat textFieldBorderThickness; // The thickness of the border stroke
  57. @property (nonatomic, assign) CGFloat textFieldBorderRadius; // The corner radius of the border
  58. @property (nonatomic, assign) CGFloat textFieldCircleDiameter; // The size of the circles in the passcode field
  59. @property (nonatomic, assign) CGFloat textFieldCircleSpacing; // The amount of spacing between each circle
  60. @property (nonatomic, assign) CGSize textFieldBorderPadding; // The amount of padding between the circles and the border
  61. @property (nonatomic, assign) NSInteger textFieldNumericCharacterLength; // The amount of circles to have in this field when set to numeric
  62. @property (nonatomic, assign) NSInteger textFieldAlphanumericCharacterLength; // The amount of circles to have in this field when set to alphanumeric
  63. @property (nonatomic, assign) CGFloat submitButtonFontSize; // The font size of the 'OK' button
  64. @property (nonatomic, assign) CGFloat submitButtonSpacing; // The spacing of the 'OK' button from the input
  65. /* Circle Button Shape and Layout */
  66. @property (nonatomic, assign) CGFloat circleButtonDiameter; // The size of each PIN button
  67. @property (nonatomic, assign) CGSize circleButtonSpacing; // The vertical/horizontal spacing between buttons
  68. @property (nonatomic, assign) CGFloat circleButtonStrokeWidth; // The thickness of the border line
  69. /* Circle Button Label */
  70. @property (nonatomic, strong) UIFont *circleButtonTitleLabelFont; // The font used for the '1' number labels
  71. @property (nonatomic, strong) UIFont *circleButtonLetteringLabelFont; // The font used for the 'ABC' labels
  72. @property (nonatomic, assign) CGFloat circleButtonLabelSpacing; // The vertical spacing between the number and lettering labels
  73. @property (nonatomic, assign) CGFloat circleButtonLetteringSpacing; // The spacing between the 'ABC' characters
  74. /* Default layout configurations for the various sizes */
  75. + (TOPasscodeViewContentLayout *)defaultScreenContentLayout; /* Default layout values. Designed for iPhone 6 Plus and above. */
  76. + (TOPasscodeViewContentLayout *)mediumScreenContentLayout; /* For medium screen sizes, like iPhone 6, or 1/4 view on iPad Pro. */
  77. + (TOPasscodeViewContentLayout *)smallScreenContentLayout; /* For the smallest screens, like iPhone SE, and 1/4 on standard size iPads/ */
  78. @end