I'm a newbie at objective C programming, so please excuse me if this question has a trivial answer.
I wanted to create a UIScrollview that's larger than the screen size. In order to be able to place all the subviews appropriately inside that main view, I tried the trick suggested in this post.
In this large UIScrollView I have several subviews, such as a ToolbarView, UITextView, UIButtons and container view.
During startup I start setupView
to update the frame size of the textview based on the actual screen size. I managed to do this in a separate nib file without too much trouble, but when I try this in the storyboard, a strange thing happens: the UITextView (paperlist
) gets initialized and a text is set to it. However, when I try to get the frame size it results in a CGRect
with zero size.
hereunder a snippet of the code I wrote:
- (void)viewWillAppear:(BOOL)animated
{
[super viewDidLoad];
[self setupView];
// Do any additional setup after loading the view.
}
#pragma mark update the view
- (void)setupView {
// first update the paperlist height in function of the screen size of the device used
CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;
CGRect newMainFrame = self.view.frame;
CGRect newPaperlistFrame = self.paperlist.frame;
newPaperlistFrame.size.height = [UIScreen mainScreen].bounds.size.height - KEYBOARD_LOWERBORDER - self.mainToolbar.bounds.size.height - statusBarHeight;
newMainFrame.size.height = self.mainToolbar.bounds.size.height + newPaperlistFrame.size.height + self.fullKeyboardView.frame.size.height;
self.view.frame = newMainFrame;
self.paperlist.frame = newPaperlistFrame;
}
Can anybody help??
thanks in advance!
Julien