Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-17-2010, 06:36 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2008
Posts: 11
Default variable height views

Hello,

I have worked on this for 2 days and I know it is possible as I have seen it in other applications, but at this point not sure that I can recreate it. Here is what I am trying to do:

UIViewController with a UIView. In the UIView I have:

Label
-Text

The height of the text under the label can vary so depending on the height of the text I need it to scroll down to show all of the text. If the text is short enough, then I there is no need to scroll. Because if it did, then you would scroll down to a blank view (all the text scrolls off the screen). What I'd like to have happen is to find the height of the text and then adjust the scroll view accordingly. I have been able to get this to work thus far:

CGSize size = [detailDescription contentSize];

What this does is gets the contentSize of my uitextview (easy enough). It took me a bit, but I got it to output the correct value when I put it in my viewDidAppear method. It shows me the variable height of the text. So, next I tried to set the height and width of my UIScrollView as follows:

detailScrollView.contentSize = CGSizeMake(320, size.height);

This didn't work as I am assuming the view was already drawn and it wasn't going to go back and recreate my UIScrollView. So, I am completely lost at this point after much searching and testing. I think I may just leave it as a bad user experience with text scrolling off to oblivion, but wanted to check with others if they had an idea.

My requirements are just:
a label at the top
under this have a UITextView or Label (just something that can pull in data)
and then have a variable height depending on the text height.

thanks for any help
Mike
wdperson is offline   Reply With Quote
Old 03-18-2010, 03:31 AM   #2 (permalink)
Registered Member
 
cordoprod's Avatar
 
Join Date: Aug 2009
Location: Norway
Age: 17
Posts: 111
Default

I am struggling for the same thing except I am working with UILabel inside UITableViewCell.
__________________
 MacBook Pro 15,4" 2,4GHz 4GB 250GB.
 Mac Mini 2,53GHz 4GB 320GB.
 iPhone 3GS Black 32GB.
cordoprod is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 299
20 members and 279 guests
ADY, Alsahir, Dani77, e2applets, iph_s, JasonR, keeshux, mer10, Monstertaco, piesia, prchn4christ, Promo Dispenser, Robiwan, Rudy, sebasx, sly24, Touchmint, twerner
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,759
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:25 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0