Skip to content

Instantly share code, notes, and snippets.

@rblalock
Created October 26, 2010 17:42
Show Gist options
  • Save rblalock/647388 to your computer and use it in GitHub Desktop.
Save rblalock/647388 to your computer and use it in GitHub Desktop.
Sample titanium searchbar with remote change of layout
var searchbar = Ti.UI.createSearchBar({
showCancel: true,
barColor: '#7CA122' // This is the default color if no remote source is used / found
});
// get the colors.json source
Ajax.xhr('GET', '', 'http://localhost/colors.json', function(data) {
searchbar.barColor = data.Colors.someColor; // change the searchbar color
win.barColor = data.Colors.otherColor; // change the window bar color
});
@rblalock
Copy link
Author

Obviously you'd want to wrap this in a conditional if those properties weren't available in the json feed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment