Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

ScrollableView - manually position the PagingControl

Hey there!

It would be great if we could position the PagingControl freely within the ScrollableView.

What I am trying to do is putting the paging control INSIDE the ScrollableView because at the moment I have placed the ScrollableView at the very bottom of the screen and you can barely see those dots.

— asked July 10th 2010 by Dominik Hahn
  • iphone
  • pagingcontrol
  • position
  • scrollableview
3 Comments
  • I have the same problem - seems like I can't get them to be totally visible in the view. Looks like they are half in, half off the bottom of the screen. Appcelerator?

    — commented July 30th 2010 by Todd Soligo
  • I have the same question? Can I position the controls inside the view? I'm trying to create a fullscreen scrollable view…

    — commented October 24th 2010 by Magnus Ottosson
  • I would like to do this thing too… but it seems there's no solution at the moment

    — commented October 27th 2010 by Davide Barlassina

2 Answers

  • Hi, this function isn't implemented in Titanium, but you can easy fix that.

    I used a transparent paging in my project to see the dots over my images.

    To make this:

    Open /Library/Application Support/Titanium/mobilesdk/osx/1.x.x/iphone/Classes/TiUIScrollableView.m (where 1.x.x is your version of sdk, like 1.4.2, 1.4.3 or 1.5.0)

    find this line in this file:

    
    viewBounds.size.height = visibleBounds.size.height - (showPageControl ? pageControlHeight : 0);
    

    and change to this:

    
    viewBounds.size.height = visibleBounds.size.height; // - (showPageControl ? pageControlHeight : 0);
    

    now, find this:

    
    contentBounds.size.height = viewBounds.size.height-(showPageControl ? pageControlHeight : 0);
    

    and change to this:

    
    contentBounds.size.height = viewBounds.size.height; //-(showPageControl ? pageControlHeight : 0);
    

    for optional i put in my code a option to contro the opacity of this bar:

    find this:

    
    -(void)setPagingControlColor_:(id)args
    {
        [[self pagecontrol] setBackgroundColor:[[TiUtils colorValue:args] _color]];
    }
    

    and paste this code before:

    
    -(void)setPagingControlOpacity_:(id)opacity
    {
        [[self pagecontrol] setAlpha:[TiUtils floatValue:opacity]];
    }
    

    Save, and make a full compile of your project.

    now to use:

    
    yourScrollable.pagingControlColor = 'YourColor';
    yourScrollable.pagingControlOpacity = YourOpacity;
    

    YourColor can be in these formats: 'transparent', 'black' or '#ff00ff'
    and YourOpacity can be: 0 (transparent) to 1 (opaque) or like this: 0.75 (75% of opacity)

    — answered December 6th 2010 by Adriano Paladini
    permalink
    9 Comments
    • Escritorio, this is a life saver. Thanks a million.

      — commented January 4th 2011 by Jay Liu
    • Beautiful!!!

      — commented February 22nd 2011 by Nathan Rambarran
    • Great. Thanks a lot. In 1.7.0RC the problem continues…

      — commented June 9th 2011 by Itinerarium Itinerarium
    • Works great in SDK 1.7.0 - thanks for the step by step too.

      — commented July 4th 2011 by Craig Jones
    • would it be possible to change only the background color to transparent and leave the dots opaque? When I add your changes the dots disappear too.

      — commented September 16th 2011 by Michael G.
    • just saw that you mentioned that I can use "transparent" as a color! That fixed it! sorry

      — commented September 16th 2011 by Michael G.
    • Is this implemented in the core now (SDK 2.1.1)?

      — commented August 21st 2012 by Daniel Krusenstråhle
    • works like a charm :)

      — commented September 3rd 2012 by dw fresh
    • This is really cool and should be in the standard SDK !

      — commented October 17th 2012 by Thomas Conte
  • bump

    Another question: 'pagingControlColor' controls the background color of the pagingControl.
    Can we change the color of the dots?

    — answered August 15th 2010 by Dominik Hahn
    permalink
    1 Comment
    • Did anybody manage to figure out if you can change the color of the dots?

      — commented January 5th 2011 by Scott Millar
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.