user1720841
user1720841

Reputation: 31

How to handle large amounts of text within iOS app?

I'm creating a universal ios app. In the app there's a story that I'd like to manually put into the app, not pulled from a server. It's not a an extremely large amount of text, but it's enough that I want it split up into different pages.

My question is: What's the best way of putting a lot of text into an app with pages that the user can just scroll through?

WARNING: I'm pretty new to programming in general, this is my first iOS app. You don't have to provide me any code, if you could point me in the right direction that would be fantastic!

-- The app is being made in storyboard if that makes a difference.

Thanks in advance

Upvotes: 3

Views: 1233

Answers (2)

Abhinandan Pratap
Abhinandan Pratap

Reputation: 2148

UITextView inherits from UIScrollView. You don't need to have a UITextView inside a UIScrollView, unless you want to add multiples views into it.

You can create a UITextView that takes the whole screen in a UIViewController like this:

UITextView *myTextView = [[UITextView alloc] initWithFrame:self.view.bounds];
myTextView.text = @"some large text";
myTextView.font = [UIFont fontWithName:@"Arial" size:20];
myTextView.scrollEnabled = YES;
myTextView.editable = NO;
[self.view addSubview:myTextView];

The property contentSize will be set automatically depending on the size of the text. You can also use [myTextView sizeToFit] method to resize the UITextView to fit its text.

Upvotes: 0

Noah
Noah

Reputation: 67

There are many ways you can do this.

  1. You can do this by showing the text on multiple views

  2. Using a scroll view. http://www.youtube.com/watch?v=D3cgi36sY-k

  3. Unsing a page view Controller.

links in the comments below

Upvotes: 1

Related Questions