One of the ways I worked for me is to create a UILabel, set the text, and then set the scrollview content size to fit it. Here is an example
Quote:
// alocate and initialize scroll UIScrollView *myScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)]; // alocate and initialize label UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 460.0f)]; // add long text to label myLabel.text = @"Lorem ipsum... long text here"; // set line break mode to word wrap myLabel.lineBreakMode = UILineBreakModeWordWrap; // set number of lines to zero myLabel.numberOfLines = 0; // resize label [myLabel sizeToFit]; // set scroll view size myScroll.contentSize = CGSizeMake(myScroll.contentSize.width, myLabel.frame.size.height); // add myLabel [myScroll addSubview:myLabel]; // add scroll view to main view [self.view addSubview:myScroll];
source share