Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-03-2008, 03:01 PM   #2 (permalink)
keyboardcowboy
Registered Member
 
Join Date: Oct 2008
Posts: 62
Default Continued

Most of the appDelegate
Code:
@synthesize window;
@synthesize viewController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
	window.backgroundColor = [UIColor blackColor];
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
}

- (void)keyboardWillShow:(NSNotification *)note {
    
	//The UIWindow that contains the keyboard view
	UIWindow* tempWindow;
	
	//Because we cant get access to the UIKeyboard throught the SDK we will just use UIView. 
	//UIKeyboard is a subclass of UIView anyways
	UIView* keyboard;
	
	//Check each window in our application
	for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; c ++)
	{
		//Get a reference of the current window
		tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c];
		
		//Get a reference of the current view 
		for(int i = 0; i < [tempWindow.subviews count]; i++)
		{
			keyboard = [tempWindow.subviews objectAtIndex:i];
			
			if([[keyboard description] hasPrefix:@"(lessThen)UIKeyboard"] == YES)
			{
				//Keyboard is now a UIView reference to the UIKeyboard we want. From here we can add a subview
				//to th keyboard like a new button
				dot = [UIButton buttonWithType:UIButtonTypeCustom];
				dot.frame = CGRectMake(0, 163, 106, 53);
				[dot setImage:[UIImage imageNamed:@"period.gif"] forState:UIControlStateNormal];
				[dot setImage:[UIImage imageNamed:@"period2.gif"] forState:UIControlStateHighlighted];
				[keyboard addSubview:dot];
				[dot addTarget:self action:@selector(addDot:)  forControlEvents:UIControlEventTouchUpInside];
				
				return;
			}
		}
	}
}
If you have any questions let me know. This is probably the only tutorial I have ever written so I understand if it was confusing. Ive also included a screen shot of the keyboard and the images for the buttons you can use to add a decimal.

Good Luck

Last edited by keyboardcowboy; 12-03-2008 at 03:03 PM.
keyboardcowboy is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,248
Threads: 39,028
Posts: 171,170
Top Poster: smasher (2,571)
Welcome to our newest member, mitch2702
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.