Skip to content

Instantly share code, notes, and snippets.

@bored-engineer
Created December 11, 2011 06:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bored-engineer/1458846 to your computer and use it in GitHub Desktop.
Save bored-engineer/1458846 to your computer and use it in GitHub Desktop.
@class EXApplication : UIApplication {
}
- tableView:table numberOfRowsInSection:section {
return 2;
}
- tableView:table cellForRowAtIndexPath:index {
var cell = [new UITableViewCell initWithStyle:UITableViewCellStyleDefault reuseIdentifier:"cell"];
[cell setText:([index row] == 0 ? "test" : "help")];
return cell;
}
- applicationDidFinishLaunching:notification {
self.array_ = [new NSMutableArray init];
var frame = [UIHardware fullScreenApplicationContentRect];
self.window_ = [new UIWindow initWithFrame:frame];
var navsize = [UINavigationBar defaultSize];
var navrect = [self.window_ bounds];
navrect.size = navsize;
self.navbar_ = [new UINavigationBar initWithFrame:navrect];
[self.window_ addSubview:self.navbar_];
self.navbar_.barStyle = UIBarStyleBlack;
var navitem = [new UINavigationItem initWithTitle:"Hello Cycript!"];
[self.navbar_ pushNavigationItem:navitem];
var bounds = [self.window_ bounds];
var offset = navsize.height;
bounds.origin.y += offset;
bounds.size.height -= offset;
self.table_ = [new UITableView initWithFrame:bounds style:UITableViewStylePlain];
[self.window_ addSubview:self.table_];
self.table_.dataSource = self;
self.table_.delegate = self;
[self.table_ reloadData];
[self.window_ makeKeyAndVisible];
}
@end
// XXX: this argv garbage is obviously stupid and WILL change: watch out!
var argv = new (*char)[system.args.length + 1];
argv[system.args.length] = null;
var strdup = new Functor(dlsym(RTLD_DEFAULT, "strdup"), "^c*");
for (index in system.args)
argv[index] = strdup(system.args[index]);
UIApplicationMain(system.args.length, argv, "EXApplication", "EXApplication");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment