Hi I am trying to place a UITextField inside a custom scrollable view. The only problem is, if the text in the textfield becomes to long, it disappears when a user scrolls. Below is my code
Code:
// ScrollView
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
scrollView.height -= 44;
// Text View
_textView = [[UITextView alloc] init];
_textView.editable = NO;
_textView.scrollEnabled = YES;
_textView.font = [UIFont appFontOfSize:14.0f];
_textView.textColor = [UIColor eventInfoColor];
_textView.backgroundColor = [UIColor whiteColor];
_textView.text = _notes;
[_textView setFrame:CGRectMake(5, 0, 290, 0)];
// Size the content
[self.view addSubview:_textView];
[_textView removeFromSuperview];
_textView.height = _textView.contentSize.height;
// Rounded View
UIView* roundedView = [UIView roundedView];
roundedView.frame = CGRectMake(10, 10, self.view.width - 20, _textView.height);
roundedView.opaque = NO;
roundedView.layer.shouldRasterize = YES;
roundedView.layer.rasterizationScale = [UIScreen mainScreen].scale;
[roundedView addSubview:_textView];
// Container
[scrollView addSubview:roundedView];
scrollView.contentSize = CGSizeMake(self.view.width, roundedView.height + 20);
// Done
[self.view addSubview:scrollView];