@@ -88,14 +88,15 @@ - (void)loadTableView
8888
8989- (void )loadCommentTextView
9090{
91- CGRect commentViewFrame = CGRectMake (0 ,
92- self.tableView .frame .size .height ,
93- self.frame .size .width -72 ,
94- self.frame .size .height -self.tableView .frame .size .height );
91+ CGPoint textViewOrigin = CGPointMake (5 , self.tableView .frame .size .height );
92+ CGRect textViewFrame = CGRectMake (textViewOrigin.x ,
93+ textViewOrigin.y ,
94+ self.frame .size .width -(72 +textViewOrigin.x ),
95+ self.frame .size .height -self.tableView .frame .size .height );
9596
9697
9798
98- UITextView *textView = [[UITextView alloc ] initWithFrame: commentViewFrame ];
99+ UITextView *textView = [[UITextView alloc ] initWithFrame: textViewFrame ];
99100 [textView setBackgroundColor: [UIColor clearColor ]];
100101 [textView setFont: [UIFont fontWithName: @" HelveticaNeue-Light" size: 16 ]];
101102 [textView setKeyboardAppearance: UIKeyboardAppearanceAlert];
@@ -116,14 +117,11 @@ - (void)loadPlaceholderForTextView:(UITextView *)textView
116117 [label setTextColor: [UIColor colorWithWhite: 0.5 alpha: 1 ]];
117118 [textView.superview insertSubview: label belowSubview: textView];
118119 [label setText: [self commentInputPlaceholderText ]];
119- [label setFrame: CGRectOffset (label.frame, 8 , -1 )];
120+ [label setFrame: CGRectOffset (label.frame, 5 , -3 )];
120121 [self setCommentTextViewPlaceholder: label];
121122}
122123
123- - (NSString *)commentInputPlaceholderText
124- {
125- return NSLocalizedString(@" Write a comment..." , @" Appears in a textbox where a user can write a comment." );
126- }
124+
127125
128126- (void )loadKeyboardFillerView
129127{
@@ -169,11 +167,6 @@ - (void)loadPostButton
169167
170168}
171169
172- - (UIColor *)postButtonColor
173- {
174- return [UIColor colorWithRed: 0 green: 118 /255.0 blue: 1.0 alpha: 1.0 ];
175- }
176-
177170- (void )setNeedsLayout
178171{
179172 CGRect newFrame = self.bounds ;
@@ -228,14 +221,16 @@ - (void)didSelectPostButton:(id)sender
228221- (void )enableCommenting
229222{
230223 [self .commentTextView setHidden: NO ];
231- [self .commentTextViewPlaceholder setHidden: NO ];
224+ // [self.commentTextViewPlaceholder setHidden:NO];
225+ [self .commentTextViewPlaceholder setText: [self commentInputPlaceholderText ]];
232226 [self .tableView setDrawsDividerLine: YES ];
233227}
234228
235229- (void )disableCommenting
236230{
237231 [self .commentTextView setHidden: YES ];
238- [self .commentTextViewPlaceholder setHidden: YES ];
232+ // [self.commentTextViewPlaceholder setHidden:YES];
233+ [self .commentTextViewPlaceholder setText: [self disabledInputPlaceholderText ]];
239234 [self .tableView setDrawsDividerLine: NO ];
240235}
241236
@@ -250,7 +245,27 @@ - (void)cancelCommenting
250245}
251246
252247
248+ #pragma mark - Colors and Text
249+
250+
251+ - (UIColor *)postButtonColor
252+ {
253+ return [UIColor colorWithRed: 0 green: 118 /255.0 blue: 1.0 alpha: 1.0 ];
254+ }
255+
256+ - (NSString *)commentInputPlaceholderText
257+ {
258+ return NSLocalizedString(@" Write a comment..." , @" Appears in a textbox where a user can write a comment." );
259+ }
260+
261+ - (NSString *)disabledInputPlaceholderText
262+ {
263+ return NSLocalizedString(@" Commenting is disabled." , @" Appears in a text box to informa a user no new comments are being accepted for a photo." );
264+ }
265+
266+
253267
268+ #pragma mark -
254269// Leave this blank to prevent UITextView from scrolling the UIPageViewController when it becomes first responder.
255270- (void )scrollRectToVisible : (CGRect)rect animated : (BOOL )animated {}
256271
0 commit comments