水平スクロールUITextViewを作成するにはどうすればよいですか?
プログラムでテキストを設定すると、自動改行が追加されるため、垂直方向にしかスクロールできません...
titleView.text = @"this is a very long text. this is a very long text. this is a very long text. this is a very long text. this is a very long text.";
回答ありがとうございます。
編集:これまでのところ、私はこれを試しました:
UIScrollview *yourScrollview = [[UIScrollView alloc] initWithFrame:CGRectMake(0 ,0 , self.view.frame.size.width, 50)];
CGFloat textLength = [titleView.text sizeWithFont:titleView.font constrainedToSize:CGSizeMake(9999, 50) lineBreakMode:NSLineBreakByWordWrapping].width;
yourScrollview.contentSize = CGSizeMake(textLength + 200, 500); //or some value you like, you may have to try this out a few times
titleView.frame = CGRectMake(titleView.frame.origin.x, titleView.frame.origin.y, textLength, titleView.frame.size.height);
[yourScrollview addSubview: titleView];
NSLog(@"%f", textLength);
しかし、私は受け取った:「脅威1:シグナルSIGABRT」