如何創建滾動UITextView的橫向?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」
加入「yourScrollView」子視圖我得到「威脅1:信號SIGABRT」後 – 2013-03-03 22:02:25
請更新您的問題,並提供一些代碼,以便人們可以看到你已經嘗試過什麼到目前爲止 – pmk 2013-03-03 22:04:16
我更新了我的問題 – 2013-03-03 22:13:07