0

I need your help / suggestions guys.

I'm using a UIScrollView (horizontal) to show some data. There is a custom UIView inside this scrollView, made in Interface Builder. I'm not using Auto layout (maybe I should... I tried, but it's doesn't look as I want, or I don't understand how it works...).

Well, here is my code where my scrollView is powered:

- (void)loadList
{
    for (int i = 0; i < [DBManager getSharedInstance].getCountItems; i++) {

        Item *item = [[DBManager getSharedInstance] getCachedItemAtIndex:i];

        PanelPage *page = [[PanelPage alloc] initWithItem:item];

        CGRect frame;
        frame.origin.x = self.scrollView.frame.size.width * i;
        frame.origin.y = 0;
        frame.size = self.scrollView.frame.size;

        page.view.frame = frame;

        [self.scrollView addSubview:page.view];

    }

    self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * [DBManager getSharedInstance].getCountItems, self.scrollView.frame.size.height);

    self.pageControl.numberOfPages = [DBManager getSharedInstance].getCountItems;
}

It works good. The size of the UIView inside the scrollView :

Height: 397px Width: 285px

I have a UINavigationBar (64px height) and a UITabBar (44px height), working on iOS 7

For screen of 4 inches, it's perfect, but on 3,5 inches, I would like to resize the view insides my scrollView, but I don't know how to proceed. A tried many things but no good results :/

Thank you so much for your help.

Any suggestion is appreciate ;)

EDIT:

Well, I can now resize my scrollview when size screen change. See: https://stackoverflow.com/a/15401903/2061450

Searching for resize the views inside the scrollview now...

Community
  • 1
  • 1
Lapinou
  • 1,467
  • 2
  • 20
  • 39

1 Answers1

0

You should call loadList function in viewDidAppear, not before (e.g. in viewDidLoad).

Bojan Bozovic
  • 872
  • 16
  • 35