~~NOTOC~~ ====== SXSwitch ====== ---- dataentry extension ---- type : extension # or 'mod' if it requires changing the Sparrow source author_mail : pixelrevision@gmail.com Malcolm description : A simple switch similar to UISwitch # enter a short description of the extension lastupdate_dt : 2011-4-11 # the date you created the extension compatible : v1.1 # the Sparrow version you tested the extension with depends : # if the ext. depends on others, list them here tags : uiswitch, switch, toggle # enter a few tags, separated by commas homepage_url : https://gist.github.com/915041 # if the ext. has an URL (e.g. a Gist-page), add it here download_url : https://gist.github.com/gists/915041/download # a direct link to the download (e.g. the Gist-archive) ---- ===== Usage ===== - (id)initWithWidth:(float)width height:(float)height { self = [super initWithWidth:width height:height]; sxSwitch = [[SXSwitch alloc] init]; [sxSwitch addEventListener:@selector(onValueChange:) atObject:self forType:SX_SWITCH_EVENT_CHANGED]; [self addChild:sxSwitch]; return self; } - (void)onValueChange:(SPEvent*)event{ NSLog(@"slider val: %@", (sxSwitch.on)?@"true":@"false"); } ===== Changelog ===== * //2011/04/12 08:25//: First public version ===== Source Code ===== %gist(915041)% ===== Discussion ===== //No comments so far. Feel free to edit this part of the page.//