Skip to content

Instantly share code, notes, and snippets.

@justinParton
Created November 9, 2011 19:45
Show Gist options
  • Save justinParton/1352711 to your computer and use it in GitHub Desktop.
Save justinParton/1352711 to your computer and use it in GitHub Desktop.
Paging Controls - Appcelerator
Got this from here: http://developer.appcelerator.com/question/42021/scrollableview---manually-position-the-pagingcontrol
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment