@@ -66,7 +66,7 @@ - (void)setUp
6666 _currentLayout = _defaultContentLayout;
6767 _contentLayouts = @[[TOPasscodeViewContentLayout mediumScreenContentLayout ],
6868 [TOPasscodeViewContentLayout smallScreenContentLayout ]];
69- _titleText = @" Enter Passcode" ;
69+ _titleText = NSLocalizedString( @" Enter Passcode" , @" " ) ;
7070
7171 // Start configuring views
7272 [self setUpViewForType: self .passcodeType];
@@ -144,36 +144,33 @@ - (void)horizontallyLayoutSubviews
144144 CGSize midViewSize = (CGSize){self.frame .size .width * 0 .5f , self.frame .size .height * 0 .5f };
145145 CGRect frame = CGRectZero;
146146
147- // Work out total height of header content
148- CGFloat headerHeight = 0 .0f ;
147+ // Work out the y offset, assuming the input field is in the middle
148+ frame.origin .y = midViewSize.height - (self.inputField .frame .size .height * 0 .5f );
149+ frame.origin .y -= (self.titleLabel .frame .size .height + self.currentLayout .titleLabelHorizontalBottomSpacing );
150+
151+ // Include offset for title view if present
149152 if (self.titleView ) {
150- headerHeight += self.titleView .frame .size .height ;
151- headerHeight += self.currentLayout .titleViewBottomSpacing ;
153+ frame.origin .y -= (self.titleView .frame .size .height + self.currentLayout .titleViewHorizontalBottomSpacing );
152154 }
153155
154- headerHeight += self.titleLabel .frame .size .height ;
155- headerHeight += self.currentLayout .titleLabelBottomSpacing ;
156-
157- headerHeight += self.inputField .frame .size .height ;
158-
159156 // Set initial Y offset
160- frame.origin .y = midViewSize. height - (headerHeight * 0 . 5f );
157+ frame.origin .y = MAX (frame. origin . y , 0 . 0f );
161158
162159 // Set frame of title view
163160 if (self.titleView ) {
164161 frame.size = self.titleView .frame .size ;
165162 frame.origin .x = (self.currentLayout .titleHorizontalLayoutWidth - frame.size .width ) * 0 .5f ;
166163 self.titleView .frame = CGRectIntegral (frame);
167164
168- frame.origin .y += (frame.size .height + self.currentLayout .titleViewBottomSpacing );
165+ frame.origin .y += (frame.size .height + self.currentLayout .titleViewHorizontalBottomSpacing );
169166 }
170167
171168 // Set frame of title label
172169 frame.size = self.titleLabel .frame .size ;
173170 frame.origin .x = (self.currentLayout .titleHorizontalLayoutWidth - frame.size .width ) * 0 .5f ;
174171 self.titleLabel .frame = CGRectIntegral (frame);
175172
176- frame.origin .y += (frame.size .height + self.currentLayout .titleLabelBottomSpacing );
173+ frame.origin .y += (frame.size .height + self.currentLayout .titleLabelHorizontalBottomSpacing );
177174
178175 // Set frame of the input field
179176 frame.size = self.inputField .frame .size ;
0 commit comments