|
|
@ -12,7 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic) UILabel *placeholderView;
|
|
|
|
@property (nonatomic) UILabel *placeholderView;
|
|
|
|
@property (nonatomic) NSArray<NSLayoutConstraint *> *placeholderConstraints;
|
|
|
|
@property (nonatomic) NSArray<NSLayoutConstraint *> *placeholderConstraints;
|
|
|
|
@property (nonatomic) BOOL isEditing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
@ -119,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
- (void)updatePlaceholderVisibility
|
|
|
|
- (void)updatePlaceholderVisibility
|
|
|
|
{
|
|
|
|
{
|
|
|
|
self.placeholderView.hidden = self.text.length > 0 || self.isEditing;
|
|
|
|
self.placeholderView.hidden = self.text.length > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)setText:(NSString *_Nullable)text
|
|
|
|
- (void)setText:(NSString *_Nullable)text
|
|
|
@ -129,13 +128,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
[self updatePlaceholderVisibility];
|
|
|
|
[self updatePlaceholderVisibility];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)setIsEditing:(BOOL)isEditing
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_isEditing = isEditing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self updatePlaceholderVisibility];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)canBecomeFirstResponder
|
|
|
|
- (BOOL)canBecomeFirstResponder
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
return YES;
|
|
|
@ -193,8 +185,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
// TODO: Is this necessary?
|
|
|
|
// TODO: Is this necessary?
|
|
|
|
|
|
|
|
|
|
|
|
[textView becomeFirstResponder];
|
|
|
|
[textView becomeFirstResponder];
|
|
|
|
|
|
|
|
|
|
|
|
self.isEditing = YES;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)textViewDidChange:(UITextView *)textView
|
|
|
|
- (void)textViewDidChange:(UITextView *)textView
|
|
|
@ -209,8 +199,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
- (void)textViewDidEndEditing:(UITextView *)textView
|
|
|
|
- (void)textViewDidEndEditing:(UITextView *)textView
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[textView resignFirstResponder];
|
|
|
|
[textView resignFirstResponder];
|
|
|
|
|
|
|
|
|
|
|
|
self.isEditing = NO;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
|
|
|
|
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
|
|
|
|