Adding UIViews with dynamic heights iphone

Posted by Andy Jacobs on Stack Overflow See other posts from Stack Overflow or by Andy Jacobs
Published on 2010-03-18T11:21:27Z Indexed on 2010/03/18 15:01 UTC
Read the original article Hit count: 498

in my viewcontroller's view i need to add a couple of custom UIView's, i do that in the loadView method

so in my custom uiview's drawRect method i add a couple of UILabel's.

in my viewcontroller's view i need to add all those custom UIView's underneath each other but i don't know what their height is

sometimes 20px, 40px, 60px, depending on the outcome of the drawRect

so when i init my custom UIView i give it a frame height of lets say 50.. but when the drawRect is done and it's only 20, 50 is too much so i need to adjust the frame height

but how can i determine what's the visible height of the custom UIView and where can i catch it in my viewcontroller when the custom uiview has finished his drawRect method

is there some kind of autoresize and where do i catch it in my viewcontroller, so i can position the custom uiview right under neath each other.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview