UIView embedded in UIScrollView hides scroll indicators ?

  • In IB I created an UIView embedded in an UIScrollView. They both fill up
    the screen and are 320 px wide.  Scrolling works just fine, but the scroll
    indicators are invisible. I triple checked the checkboxes in IB, and both
    "Scrolling Enabled" and "Shows Vertical Scrollers" are on.  To be super
    sure I added this to my VC:

        self.scrollView.scrollEnabled = YES;

        self.scrollView.showsVerticalScrollIndicator = YES;

    I tried making the UIView a little less wide (300px), but I still don't see
    the scroll indicators.

    What did I miss to make them appear?

    Thanks,

    - Koen.
  • Did you forgot to set the contentSize for the UIScrollView?

    On 18/05/2013, at 14:43, Koen van der Drift <koenvanderdrift...> wrote:

    > In IB I created an UIView embedded in an UIScrollView. They both fill up
    > the screen and are 320 px wide.  Scrolling works just fine, but the scroll
    > indicators are invisible. I triple checked the checkboxes in IB, and both
    > "Scrolling Enabled" and "Shows Vertical Scrollers" are on.  To be super
    > sure I added this to my VC:
    >
    > self.scrollView.scrollEnabled = YES;
    >
    > self.scrollView.showsVerticalScrollIndicator = YES;
    >
    > I tried making the UIView a little less wide (300px), but I still don't see
    > the scroll indicators.
    >
    > What did I miss to make them appear?
    >
    > Thanks,
    >
    > - Koen.
  • Yes, I did, but I may have made a mistake. I have this in viewDidLoad:

    self.scrollView.contentSize = CGSizeMake(320, self.myView.frame.size.height
    + self.tabBarController.tabBar.frame.size.height);

    I also found that if I add either

    self.scrollView.bounds = self.view.bounds;  or  self.scrollView.frame self.view.frame;

    I do see the scrollbar, but the content myView is cut off on the right
    side.

    So, then I decided to ditch my XIB and to create the two views in my VC,
    and presto, it works!

    - Koen.

    On Sat, May 18, 2013 at 1:50 PM, Marcelo Alves <marcelo.alves...> wrote:

    >
    > Did you forgot to set the contentSize for the UIScrollView?
    >
    >
    > On 18/05/2013, at 14:43, Koen van der Drift <koenvanderdrift...>
    > wrote:
    >
    >> In IB I created an UIView embedded in an UIScrollView. They both fill up
    >> the screen and are 320 px wide.  Scrolling works just fine, but the
    > scroll
    >> indicators are invisible. I triple checked the checkboxes in IB, and both
    >> "Scrolling Enabled" and "Shows Vertical Scrollers" are on.  To be super
    >> sure I added this to my VC:
    >>
    >> self.scrollView.scrollEnabled = YES;
    >>
    >> self.scrollView.showsVerticalScrollIndicator = YES;
    >>
    >> I tried making the UIView a little less wide (300px), but I still don't
    > see
    >> the scroll indicators.
    >>
    >> What did I miss to make them appear?
    >>
    >> Thanks,
    >>
    >> - Koen.

    >
  • On May 18, 2013, at 11:28 AM, Koen van der Drift <koenvanderdrift...> wrote:

    > Yes, I did, but I may have made a mistake. I have this in viewDidLoad:
    >
    > self.scrollView.contentSize = CGSizeMake(320, self.myView.frame.size.height
    > + self.tabBarController.tabBar.frame.size.height);
    >
    > I also found that if I add either
    >
    > self.scrollView.bounds = self.view.bounds;  or  self.scrollView.frame > self.view.frame;

    Neither of these variations are really correct. Bounds is the internal coordinate system, frame is the external coordinate system. I suspect what you really want is self.scrollView.frame = self.view.bounds.

    >
    > I do see the scrollbar, but the content myView is cut off on the right
    > side.
    >
    >
    > So, then I decided to ditch my XIB and to create the two views in my VC,
    > and presto, it works!
    >
    > - Koen.
    >
    >
    > On Sat, May 18, 2013 at 1:50 PM, Marcelo Alves <marcelo.alves...> wrote:
    >
    >>
    >> Did you forgot to set the contentSize for the UIScrollView?
    >>
    >>
    >> On 18/05/2013, at 14:43, Koen van der Drift <koenvanderdrift...>
    >> wrote:
    >>
    >>> In IB I created an UIView embedded in an UIScrollView. They both fill up
    >>> the screen and are 320 px wide.  Scrolling works just fine, but the
    >> scroll
    >>> indicators are invisible. I triple checked the checkboxes in IB, and both
    >>> "Scrolling Enabled" and "Shows Vertical Scrollers" are on.  To be super
    >>> sure I added this to my VC:
    >>>
    >>> self.scrollView.scrollEnabled = YES;
    >>>
    >>> self.scrollView.showsVerticalScrollIndicator = YES;
    >>>
    >>> I tried making the UIView a little less wide (300px), but I still don't
    >> see
    >>> the scroll indicators.
    >>>
    >>> What did I miss to make them appear?
    >>>
    >>> Thanks,
    >>>
    >>> - Koen.

    >>


    --
    David Duncan
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today