TOPasscodeViewContentLayout.m 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 = 35.0f;
  45. /* The Subtitle Label */
  46. contentLayout.subtitleLabelFont = [UIFont systemFontOfSize: 17.0f];
  47. contentLayout.subtitleLabelBottomSpacing = 40.0f;
  48. contentLayout.subtitleLabelHorizontalBottomSpacing = 40.0f;
  49. /* Text Field Input Configuration */
  50. contentLayout.textFieldBorderThickness = 1.5f;
  51. contentLayout.textFieldBorderRadius = 5.0f;
  52. contentLayout.textFieldCircleDiameter = 10.0f;
  53. contentLayout.textFieldCircleSpacing = 6.0f;
  54. contentLayout.textFieldBorderPadding = (CGSize){10, 10};
  55. contentLayout.textFieldNumericCharacterLength = 10;
  56. contentLayout.textFieldAlphanumericCharacterLength = 15;
  57. contentLayout.submitButtonFontSize = 17.0f;
  58. contentLayout.submitButtonSpacing = 4.0f;
  59. /* Circle Button Shape and Layout */
  60. contentLayout.circleButtonDiameter = 90.0f;
  61. contentLayout.circleButtonSpacing = (CGSize){25.0f, 16.0f};
  62. contentLayout.circleButtonStrokeWidth = 1.5f;
  63. /* Circle Button Label */
  64. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:37.5f weight:UIFontWeightThin];
  65. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:9.0f weight:UIFontWeightThin];
  66. contentLayout.circleButtonLabelSpacing = 6.0f;
  67. contentLayout.circleButtonLetteringSpacing = 3.0f;
  68. return contentLayout;
  69. }
  70. + (TOPasscodeViewContentLayout *)mediumScreenContentLayout
  71. {
  72. TOPasscodeViewContentLayout *contentLayout = [[TOPasscodeViewContentLayout alloc] init];
  73. /* Width of the PIN View */
  74. contentLayout.viewWidth = 375.0f;
  75. /* Bottom Padding */
  76. contentLayout.bottomPadding = 17.0f;
  77. /* Title View Constraints */
  78. contentLayout.titleViewBottomSpacing = 20.0f;
  79. /* The Title Label Explaining the PIN View */
  80. contentLayout.titleLabelFont = [UIFont systemFontOfSize: 19.0f];
  81. contentLayout.titleLabelBottomSpacing = 23.0f;
  82. /* Horizontal title constraints */
  83. contentLayout.titleHorizontalLayoutWidth = 185.0f;
  84. contentLayout.titleHorizontalLayoutSpacing = 16.0f;
  85. contentLayout.titleViewHorizontalBottomSpacing = 18.0f;
  86. contentLayout.titleLabelHorizontalBottomSpacing = 18.0f;
  87. /* Circle Row Configuration */
  88. contentLayout.circleRowDiameter = 13.5f;
  89. contentLayout.circleRowSpacing = 26.0f;
  90. contentLayout.circleRowBottomSpacing = 21.0f;
  91. /* The Subtitle Label */
  92. contentLayout.subtitleLabelFont = [UIFont systemFontOfSize: 14.0f];
  93. contentLayout.subtitleLabelHorizontalBottomSpacing = 20.0f;
  94. contentLayout.subtitleLabelBottomSpacing = 20.0f;
  95. /* Submit Button */
  96. contentLayout.submitButtonFontSize = 16.0f;
  97. contentLayout.submitButtonSpacing = 4.0f;
  98. /* Circle Button Shape and Layout */
  99. contentLayout.circleButtonDiameter = 80.0f;
  100. contentLayout.circleButtonSpacing = (CGSize){28.0f, 15.0f};
  101. contentLayout.circleButtonStrokeWidth = 1.5f;
  102. /* Text Field Input Configuration */
  103. contentLayout.textFieldBorderThickness = 1.5f;
  104. contentLayout.textFieldBorderRadius = 5.0f;
  105. contentLayout.textFieldCircleDiameter = 9.0f;
  106. contentLayout.textFieldCircleSpacing = 5.0f;
  107. contentLayout.textFieldBorderPadding = (CGSize){10, 10};
  108. contentLayout.textFieldNumericCharacterLength = 10;
  109. contentLayout.textFieldAlphanumericCharacterLength = 15;
  110. /* Circle Button Label */
  111. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:36.5f weight:UIFontWeightThin];
  112. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:8.5f weight:UIFontWeightThin];
  113. contentLayout.circleButtonLabelSpacing = 5.0f;
  114. contentLayout.circleButtonLetteringSpacing = 2.5f;
  115. return contentLayout;
  116. }
  117. + (TOPasscodeViewContentLayout *)smallScreenContentLayout
  118. {
  119. TOPasscodeViewContentLayout *contentLayout = [[TOPasscodeViewContentLayout alloc] init];
  120. /* Width of the PIN View */
  121. contentLayout.viewWidth = 320.0f;
  122. /* Bottom Padding */
  123. contentLayout.bottomPadding = 12.0f;
  124. /* Title View Constraints */
  125. contentLayout.titleViewBottomSpacing = 15.0f;
  126. /* The Title Label Explaining the PIN View */
  127. contentLayout.titleLabelFont = [UIFont systemFontOfSize: 16.0f];
  128. contentLayout.titleLabelBottomSpacing = 19.0f;
  129. /* Horizontal title constraints */
  130. contentLayout.titleHorizontalLayoutWidth = 185.0f;
  131. contentLayout.titleHorizontalLayoutSpacing = 5.0f;
  132. contentLayout.titleViewHorizontalBottomSpacing = 18.0f;
  133. contentLayout.titleLabelHorizontalBottomSpacing = 18.0f;
  134. /* Circle Row Configuration */
  135. contentLayout.circleRowDiameter = 12.5f;
  136. contentLayout.circleRowSpacing = 22.0f;
  137. contentLayout.circleRowBottomSpacing = 19.0f;
  138. /* The Subtitle Label */
  139. contentLayout.subtitleLabelFont = [UIFont systemFontOfSize: 12.0f];
  140. contentLayout.subtitleLabelHorizontalBottomSpacing = 22.0f;
  141. contentLayout.subtitleLabelBottomSpacing = 19.0f;
  142. /* Text Field Input Configuration */
  143. contentLayout.textFieldBorderThickness = 1.5f;
  144. contentLayout.textFieldBorderRadius = 5.0f;
  145. contentLayout.textFieldCircleDiameter = 8.0f;
  146. contentLayout.textFieldCircleSpacing = 4.0f;
  147. contentLayout.textFieldBorderPadding = (CGSize){8, 8};
  148. contentLayout.textFieldNumericCharacterLength = 10;
  149. contentLayout.textFieldAlphanumericCharacterLength = 15;
  150. /* Submit Button */
  151. contentLayout.submitButtonFontSize = 15.0f;
  152. contentLayout.submitButtonSpacing = 3.0f;
  153. /* Circle Button Shape and Layout */
  154. contentLayout.circleButtonDiameter = 70.0f;
  155. contentLayout.circleButtonSpacing = (CGSize){20.0f, 8.5f};
  156. contentLayout.circleButtonStrokeWidth = 1.5f;
  157. /* Circle Button Label */
  158. contentLayout.circleButtonTitleLabelFont = [UIFont systemFontOfSize:35.0f weight:UIFontWeightThin];
  159. contentLayout.circleButtonLetteringLabelFont = [UIFont systemFontOfSize:9.0f weight:UIFontWeightThin];
  160. contentLayout.circleButtonLabelSpacing = 4.5f;
  161. contentLayout.circleButtonLetteringSpacing = 2.0f;
  162. return contentLayout;
  163. }
  164. @end