Prevent word wrap using UITextView

using iphone sdk 3.1.2

I have a UITextView control with vertical and horizontal scrolling enabled. I want each line of text to be displayed without packaging so that the user can scroll it horizontally to see it. The problem is that even with horizontal scrolling turned on, the text flows around the width of the iphone ie320 pixels screen.

How to prevent packaging?

thanks

+5
source share
6 answers

I think you are stuck with putting a UIText field in a scrollview.

+1
source

sizeWithFont: NSString UIKit, , UITextView contentSize , .

, UITextView. UITextView contentSize.width , . contentSize.width uitextview.text, , .

contentize.width , contentSize reset, .

, , . , , , contentSize . , - .

, , uitextviews . , . HTML...

+5

, UITextView, UIScrollView. , "DualScrollTextView" google.

+3

. Auto Layout.

  • UITextView scrollView. , .

  • IBOutlet UITextView. "heightConstraint" "widthConstraint"

  • :

    - (void)viewWillLayoutSubviews {
        CGSize fit = [self.textView sizeThatFits:CGSizeMake(10000, 10000)];
        self.widthConstraint.constant = fit.width;
        self.heightConstraint.constant = fit.height;
    }
    

, UITextView , , ,

+3

Woot .

I set the width of the UITextView 500 to .xib. In my code, I set myUITextView.text = @ "some huge line with many lines";

Then I set myUITextView.contentSize = CGSizeMake (600, myUITextView.contentSize.height);

Of course, you can use any width you want; just make sure the last one is bigger.

0
source

I forever realized that there was \ n in my data. So it was not after all! In case this happens to you:

self.titleText.text = viewModel.title.replacingOccurrences(of: "\n", with: "");
0
source

All Articles