I have DetailView in which there are three textviews which are showing different informations. is it possible that on whenever i scroll down to read all information. all those textviews scroll like they are one page. i mean they look like one textview. i m doing this bcz i need those information in different fonts. and if there is any other nice approach i can use to show that information? plz tell me. thanx in advance.
Asked
Active
Viewed 113 times
1 Answers
1
Yes, you can place those three UITextViews into a UIScrollView, set userInteractionEnabled = NO in the UITextViews, and properly set the contentSize of the UIScrollView to cover all 3 UITextField size, then they will all scroll as one unit and the UITextViews won't scroll at all within themselves. (Again: a UIScrollView will not scroll in height / width unless the contentSize property's height / width is larger than its frame property height / width).

Bogatyr
- 19,255
- 7
- 59
- 72
-
well i did the same as u said. but its not working. but its not scrolling. i can't see last textview's some text because its not scrollable. – Piscean Feb 12 '11 at 00:00
-
then you need to increase the frame size of the textviews so that the text is all visible, and the content size of the scrollview so that you can scroll to the bottom of the last one – Bogatyr Feb 12 '11 at 04:24
-
but if the text is so much that it can't fit in the frame size of textviews. then? and ofcourse we can't scroll it bcz userinteraction is disabled. may be is there any other outlet i can use instead of textviews. – Piscean Feb 12 '11 at 10:30
-
Again, change the frame size of each textview so that all the text is visible fully in each UITextView, then add up the frames of all the textviews and make that be the contentSize of the UIScrollView. You may need to experiment with the frame size of each text view until you get it just the right size. userInterActionEnable = NO should only be set for each textview – Bogatyr Feb 12 '11 at 10:51
-
i cant stretch my View window in which i m putting scroll view. it means i cant make scrollview bigger than that view window. and i think thats y its not scrolling. – Piscean Feb 12 '11 at 19:21
-
In interface Builder, select the view, then hit CMD-3 (the Size Inspector), and enter the size manually. You can also set the frame size manually in code: myView.frame = CGRectMake( x, y, width, height ); – Bogatyr Feb 12 '11 at 20:28
-
yeah its working now. thanx. but i have one more question. some of my data details are long and some are small. now scroller content size is same for both. when its small data then its alot of space in the end. is it possible to do in that way that if its small data ,scroller content size ll change automatically according to that data. – Piscean Feb 16 '11 at 09:51
-
I don't think UIScrollViews can auto-adjust to their content. You could create a subclass that does this, but you'd have to write it yourself. – Bogatyr Feb 16 '11 at 10:08