I am trying to add a UITextView
on UIScrollview
. and then add the UIScrollView
onto a UIView
. The adding scrollView to UIView
works however adding UITextView
to a UISCrollView
Does not work. Any pointers?
Thanks
UIScrollView * contentScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(300, 400, 250, 250)];
contentScrollView.backgroundColor = [UIColor whiteColor];
UITextView * mainContent = [[UITextView alloc]initWithFrame:CGRectMake(300, 400, 200, 200)];
mainContent.text = @"HELLO";
mainContent.textColor = [UIColor blackColor];
[contentScrollView addSubview:mainContent];
[contentScrollView setUserInteractionEnabled:YES];
[contentView addSubview:contentScrollView];
your height of scrol view is 250 and width also 250. but u are giving the frame of textview beyond these limits i.e. 300, and 400. limit them to 250, 250 like
UITextView * mainContent = [[UITextView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];