TOPasscodeViewContentLayout.m 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // TOPasscodeViewContentLayout.m
  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 "TOPasscodeViewContentLayout.h"
  23. @implementation TOPasscodeViewContentLayout
  24. + (TOPasscodeViewContentLayout *)defaultScreenContentLayout
  25. {
  26. TOPasscodeViewContentLayout *contentLayout = [[TOPasscodeViewContentLayout alloc] init];
  27. /* Width of the PIN View */
  28. contentLayout.viewWidth = 414.0f;
  29. /* Bottom Padding */
  30. contentLayout.bottomPadding = 25.0f;
  31. /* Title View Constraints */
  32. contentLayout.titleViewBottomSpacing = 34.0f;
  33. /* The Title Label Explaining the PIN View */
  34. contentLayout.titleLabelBottomSpacing = 34.0f;
  35. contentLayout.titleLabelFont = [UIFont systemFontOfSize: 22.0f];
  36. /* Horizontal title constraints */
  37. contentLayout.titleHorizontalLayoutWidth = 250.0f;
  38. contentLayout.titleHorizontalLayoutSpacing = 35.0f;
  39. contentLayout.titleViewHorizontalBottomSpacing = 20.0f;
  40. contentLayout.titleLabelHorizontalBottomSpacing = 20.0f;
  41. /* Circle Row Configuration */
  42. contentLayout.circleRowDiameter = 15.5f;
  43. contentLayout.circleRowSpacing = 30.0f;
  44. contentLayout.circleRowBottomSpacing = 61.0f;
  45. /* Text Field Input Configuration */
  46. contentLayout.textFieldBorderThickness = 1.5f;
  47. contentLayout.textFieldBorderRadius = 5.0f;
  48. contentLayout.textFieldCircleDiameter = 10.0f;
  49. contentLayout.textFieldCircleSpacing = 6.0f;
  50. contentLayout.textFieldBorderPadding = (CGSize){10, 10};
  51. contentLayout.textFieldNumericCharacterLength = 10;
  52. contentLayout.textFieldAlphanumericCharacterLength = 15;
  53. contentLayout.submitButtonFontSize = 17.0f;
  54. contentLayout.submitButtonSpacing = 4.0f;
  55. /* Circle Button Shape and Layout */
  56. contentLayout.circleButtonDiameter = 81.0f;
  57. contentLayout.circleButtonSpacing = (CGSize){25.0f, 20.0f};
  58. contentLayout.circleButtonStrokeWidth = 1.5f;
  59. /* Circle Button Label */
  60. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:37.5f weight:UIFontWeightThin];
  61. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:9.0f weight:UIFontWeightThin];
  62. contentLayout.circleButtonLabelSpacing = 6.0f;
  63. contentLayout.circleButtonLetteringSpacing = 3.0f;
  64. return contentLayout;
  65. }
  66. + (TOPasscodeViewContentLayout *)mediumScreenContentLayout
  67. {
  68. TOPasscodeViewContentLayout *contentLayout = [[TOPasscodeViewContentLayout alloc] init];
  69. /* Width of the PIN View */
  70. contentLayout.viewWidth = 375.0f;
  71. /* Bottom Padding */
  72. contentLayout.bottomPadding = 17.0f;
  73. /* Title View Constraints */
  74. contentLayout.titleViewBottomSpacing = 27.0f;
  75. /* The Title Label Explaining the PIN View */
  76. contentLayout.titleLabelBottomSpacing = 24.0f;
  77. contentLayout.titleLabelFont = [UIFont systemFontOfSize: 20.0f];
  78. /* Horizontal title constraints */
  79. contentLayout.titleHorizontalLayoutWidth = 185.0f;
  80. contentLayout.titleHorizontalLayoutSpacing = 16.0f;
  81. contentLayout.titleViewHorizontalBottomSpacing = 18.0f;
  82. contentLayout.titleLabelHorizontalBottomSpacing = 18.0f;
  83. /* Circle Row Configuration */
  84. contentLayout.circleRowDiameter = 13.5f;
  85. contentLayout.circleRowSpacing = 26.0f;
  86. contentLayout.circleRowBottomSpacing = 53.0f;
  87. /* Submit Button */
  88. contentLayout.submitButtonFontSize = 16.0f;
  89. contentLayout.submitButtonSpacing = 4.0f;
  90. /* Circle Button Shape and Layout */
  91. contentLayout.circleButtonDiameter = 75.0f;
  92. contentLayout.circleButtonSpacing = (CGSize){28.0f, 15.0f};
  93. contentLayout.circleButtonStrokeWidth = 1.5f;
  94. /* Text Field Input Configuration */
  95. contentLayout.textFieldBorderThickness = 1.5f;
  96. contentLayout.textFieldBorderRadius = 5.0f;
  97. contentLayout.textFieldCircleDiameter = 9.0f;
  98. contentLayout.textFieldCircleSpacing = 5.0f;
  99. contentLayout.textFieldBorderPadding = (CGSize){10, 10};
  100. contentLayout.textFieldNumericCharacterLength = 10;
  101. contentLayout.textFieldAlphanumericCharacterLength = 15;
  102. /* Circle Button Label */
  103. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:36.5f weight:UIFontWeightThin];
  104. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:8.5f weight:UIFontWeightThin];
  105. contentLayout.circleButtonLabelSpacing = 5.0f;
  106. contentLayout.circleButtonLetteringSpacing = 2.5f;
  107. return contentLayout;
  108. }
  109. + (TOPasscodeViewContentLayout *)smallScreenContentLayout
  110. {
  111. TOPasscodeViewContentLayout *contentLayout = [[TOPasscodeViewContentLayout alloc] init];
  112. /* Width of the PIN View */
  113. contentLayout.viewWidth = 320.0f;
  114. /* Bottom Padding */
  115. contentLayout.bottomPadding = 12.0f;
  116. /* Title View Constraints */
  117. contentLayout.titleViewBottomSpacing = 23.0f;
  118. /* The Title Label Explaining the PIN View */
  119. contentLayout.titleLabelBottomSpacing = 23.0f;
  120. contentLayout.titleLabelFont = [UIFont systemFontOfSize: 17.0f];
  121. /* Horizontal title constraints */
  122. contentLayout.titleHorizontalLayoutWidth = 185.0f;
  123. contentLayout.titleHorizontalLayoutSpacing = 5.0f;
  124. contentLayout.titleViewHorizontalBottomSpacing = 18.0f;
  125. contentLayout.titleLabelHorizontalBottomSpacing = 18.0f;
  126. /* Circle Row Configuration */
  127. contentLayout.circleRowDiameter = 12.5f;
  128. contentLayout.circleRowSpacing = 22.0f;
  129. contentLayout.circleRowBottomSpacing = 44.0f;
  130. /* Text Field Input Configuration */
  131. contentLayout.textFieldBorderThickness = 1.5f;
  132. contentLayout.textFieldBorderRadius = 5.0f;
  133. contentLayout.textFieldCircleDiameter = 8.0f;
  134. contentLayout.textFieldCircleSpacing = 4.0f;
  135. contentLayout.textFieldBorderPadding = (CGSize){8, 8};
  136. contentLayout.textFieldNumericCharacterLength = 10;
  137. contentLayout.textFieldAlphanumericCharacterLength = 15;
  138. /* Submit Button */
  139. contentLayout.submitButtonFontSize = 15.0f;
  140. contentLayout.submitButtonSpacing = 3.0f;
  141. /* Circle Button Shape and Layout */
  142. contentLayout.circleButtonDiameter = 76.0f;
  143. contentLayout.circleButtonSpacing = (CGSize){20.0f, 12.5f};
  144. contentLayout.circleButtonStrokeWidth = 1.5f;
  145. /* Circle Button Label */
  146. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:35.0f weight:UIFontWeightThin];
  147. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:9.0f weight:UIFontWeightThin];
  148. contentLayout.circleButtonLabelSpacing = 4.5f;
  149. contentLayout.circleButtonLetteringSpacing = 2.0f;
  150. return contentLayout;
  151. }
  152. @end