Closed mattlogan closed 6 years ago
Hmm, can you share your project? It works on my machine. I tested with the demo project.
// ViewController.h
@property (nonatomic, strong) IBOutlet UITextView *textView;
// ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.textView.placeholder = @"Placeholder text";
self.textView.text = @"My real text";
}
I was able to fix my issue by setting the placeholder text before setting the TextView's text. You can reproduce by changing the above code to:
// ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.textView.text = @"My real text";
self.textView.placeholder = @"Placeholder text";
}
Not sure if this is a bug worth fixing but it might be worth documenting! Thanks for the response.
I could reproduce the bug with your code. #50 is a patch for the issue. Could you check this? Thanks!
I'm not sure this is the right fix. When I apply your patch, I'm now seeing the text overlapping the placeholder view:
I should have written enough tests... 🤦♂️ I have fixed the PR, could you please check it again?
This looks good! I verified it in my project.
I have a UITextView with font size 22, specified in interface builder. I have the following code in
viewDidLoad()
.The UITextView appears with "My real text" at the correct font size, but when I delete this text to reveal the placeholder, the placeholder font size appears to be 17 (or some smaller default).