Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#import "SampleApp.h" @implementation SampleApp - (void)menuButtonUp:(struct __GSEvent *)fp8 { [self terminate]; } - (void)menuButtonDown:(struct __GSEvent *)fp8 { [self terminate]; } - (void)navigationBar:(UINavigationBar*)bar buttonClicked:(int)button { if (button == 0) { [textView setText:@"Goodbye World"]; } else if (button == 1) { [textView setText:@"Hello World"]; } } - (void) applicationDidFinishLaunching: (id) unused { UIWindow *window; struct CGRect rect = [UIHardware fullScreenApplicationContentRect]; rect.origin.x = rect.origin.y = 0.0f; window = [[UIWindow alloc] initWithContentRect: rect]; mainView = [[UIView alloc] initWithFrame: rect]; textView = [[UITextView alloc] initWithFrame: CGRectMake(0.0f, 48.0f, 320.0f, 480.0f - 48.0f)]; [textView setEditable:NO]; [textView setTextSize:28]; nav = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)]; [nav showButtonsWithLeftTitle: @"Hello" rightTitle: @"Bye" leftBack: NO]; [nav setBarStyle: 0]; [nav setDelegate: self]; [window orderFront: self]; [window makeKey: self]; [window _setHidden: NO]; [window setContentView: mainView]; [mainView addSubview:textView]; [mainView addSubview:nav]; [textView setText:@"Press Hello or Bye."]; } @end
This paste will be private.
From the Design Piracy series on my blog: