All pastes #825107 Raw Edit

n1mda

public text v1 · immutable
#825107 ·published 2007-12-20 10:32 UTC
rendered paste body
#import "IRCn1mda.h"

@implementation IRCn1mda

- (void) navigationBar: (UINavigationBar*)mainNavBar buttonClicked:(int) button
{
	
		if(button == 1)
		{
			NSLog(@"Add server");
			[window setContentView: channelView];
		}
		if(button == 0)
		{
			NSLog(@"Connect to server");
			/* do something*/
		} 
	
}

- (void) applicationDidFinishLaunching: (id) unused
{
	float black[4]		= {0.0f, 0.0f, 0.0f, 1.0f};


	struct CGRect rect	= [UIHardware fullScreenApplicationContentRect];

	rect.origin.x		= rect.origin.y = 0;

	UIWindow* window	= [[UIWindow alloc] initWithContentRect: rect];
	[window orderFront: self];
	[window makeKey: self];
	[window _setHidden: NO];

	UIView* mainView	= [[[UIView alloc] initWithFrame: rect] autorelease];
	[window setContentView: mainView];
	/*[mainView setBackgroundColor: CGColorCreate(CGColorSpaceCreateDeviceRGB(), black)];*/

	UIView* channelView	= [[[UIView alloc] initWithFrame: rect] autorelease];
	[channelView setBackgroundColor: CGColorGreate(CGColorSpaceCreateDeviceRGB(), black)];

	UINavigationBar *mainNavBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)];
	[mainNavBar setBarStyle: 1];
	[mainNavBar showButtonsWithLeftTitle:@"+" rightTitle:@"Connect" leftBack: FALSE];
	[mainView addSubview: mainNavBar];
	[mainNavBar setDelegate: self];
	NSLog(@"mainNabBar added");
	
	UINavigationItem *IRCn1mdatitle = [[UINavigationItem alloc] initWithTitle:@"IRCn1mda 0.1"];
	[mainNavBar pushNavigationItem:IRCn1mdatitle];
	NSLog(@"Title added to mainNavBar");

	UITable* serverTable = [[UITable alloc] initWithFrame:CGRectMake(rect.origin.x, 48.0f, rect.size.width, rect.size.height - 48.0f)];
	UITableColumn *col = [[UITableColumn alloc] initWithTitle:@"Servers" identifier:@"servers" width:rect.size.width];
	[serverTable addTableColumn:col];
	[serverTable setSeparatorStyle: 1];
	[serverTable setRowHeight: 45];
	/*[serverTable setDataSource: self];*/
	/*[serverTable setDelegate: self];
	[serverTable reloadData];*/
	[mainView addSubview: serverTable];
	NSLog(@"serverTable created");
}

@end