Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS 7 UITextView vertical alignment
    primarykey
    data
    text
    <p>How is that possible that my editable <code>UITextView</code> (placed inside a straightforward UIViewController inside a <code>UISplitView</code> that acts as delegate for the <code>UITextView</code>) is not showing text from the beginning but after something like 6-7 lines?</p> <p><img src="https://i.stack.imgur.com/Eq7DR.png" alt="Screenshot"></p> <p>I didn't set any particular autolayout or something similar, trying to delete text doesn't help (so no hidden chars or something).</p> <p>I'm using iOS 7 on iPad, in storyboard looks good... The problem is the same on iOS simulator and real devices. I'm getting mad :P</p> <p>Here's some code. This is the ViewController <code>viewDidLoad()</code></p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.itemTextField.delegate = self; self.itemTextField.text = NSLocalizedString(@"NEWITEMPLACEHOLDER", nil); self.itemTextField.textColor = [UIColor lightGrayColor]; //optional } </code></pre> <p>And here are the overridden functions for the <code>UITextView</code> I'm using some code I've found on StackOverflow to simulate a placeholder for the view (the same stuff on iPhone version of the storyboard works fine)...</p> <pre><code>// UITextView placeholder - (void)textViewDidBeginEditing:(UITextView *)textView { if ([textView.text isEqualToString:NSLocalizedString(@"NEWITEMPLACEHOLDER", nil)]) { textView.text = @""; textView.textColor = [UIColor blackColor]; //optional } [textView becomeFirstResponder]; } - (void)textViewDidEndEditing:(UITextView *)textView { if ([textView.text isEqualToString:@""]) { textView.text = NSLocalizedString(@"NEWITEMPLACEHOLDER", nil); textView.textColor = [UIColor lightGrayColor]; //optional } [textView resignFirstResponder]; } -(void)textViewDidChange:(UITextView *)textView { int len = textView.text.length; charCount.text = [NSString stringWithFormat:@"%@: %i", NSLocalizedString(@"CHARCOUNT", nil),len]; } - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { return YES; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload