Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-08-2011, 09:17 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 2
webdesigndeluxe is on a distinguished road
Default Help working with a custom keyboard.

Hey everyone, I'm new to the iPhone Dev SDK site. Hope it will help me as I'm still a noob to iPhone development. I'm creating an app that has a custom numeric keyboard. I have an IBAction 'buttonDigitPressed' that when a digit is pressed it will simply add the digit to a UILabel. Now I have another label that I wish to do the same yet I'm not sure how to gain 'focus' of that particular label. I placed an invisible button over the second label so when pressed hopefully I can call an action to switch the keyboard from the first label to the second label. Yet I have no clue how to accomplish this. Any help would be greatly appreciated!
webdesigndeluxe is offline   Reply With Quote
Old 03-08-2011, 09:40 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 154
Bobarino is on a distinguished road
Default

Quote:
Originally Posted by webdesigndeluxe View Post
Hey everyone, I'm new to the iPhone Dev SDK site. Hope it will help me as I'm still a noob to iPhone development. I'm creating an app that has a custom numeric keyboard. I have an IBAction 'buttonDigitPressed' that when a digit is pressed it will simply add the digit to a UILabel. Now I have another label that I wish to do the same yet I'm not sure how to gain 'focus' of that particular label. I placed an invisible button over the second label so when pressed hopefully I can call an action to switch the keyboard from the first label to the second label. Yet I have no clue how to accomplish this. Any help would be greatly appreciated!
Could you show code for this custom keyboard. Also, you don't need to have an invisible button over the label. When creating the button just change its type to custom in attributes and work off of that (just easier to do for the future).
Bobarino is offline   Reply With Quote
Old 03-08-2011, 09:45 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 2
webdesigndeluxe is on a distinguished road
Default

Quote:
Originally Posted by Bobarino View Post
Could you show code for this custom keyboard. Also, you don't need to have an invisible button over the label. When creating the button just change its type to custom in attributes and work off of that (just easier to do for the future).
Well yes, that's what I meant by 'invisible button' just a button over the label with the custom attribute.

Here's the viewController.h:

Code:
@interface ComparatorViewController : UIViewController {
	
	float result;
	IBOutlet UILabel *priceOne;
	IBOutlet UILabel *priceTwo;
	IBOutlet UILabel *unitOne;
	IBOutlet UILabel *unitTwo;
	int currentOperation;
	double currentNumber;

}


-(IBAction)buttonDigitPressed:(id)sender;
-(IBAction)priceTwoPressed:(id)sender;

@end
Then the viewController.m:

Code:
@implementation ComparatorViewController


-(IBAction)buttonDigitPressed:(id)sender {
	currentNumber = currentNumber*10 + (double)[sender tag];
	priceOne.text = [NSString stringWithFormat:@"%.2f",currentNumber / 100.0f];

}
The IBAction 'buttonDigitPressed' is linked to each button or number in this case for keyboard.
webdesigndeluxe is offline   Reply With Quote
Old 03-08-2011, 10:12 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 154
Bobarino is on a distinguished road
Default

Is the keyboard supposed to be the same in both labels? I personally have never worked with custom keyboards, but my guess would be you do what you did with the first label to the second label. If the keyboard doesn't change and is supposed to be the same thing in the other label, maybe make another IBaction with the same code and apply that to the second label. Like I said, I have never worked with a custom keyboard, but if you are looking for the same keyboard to pop up in the other label, then just rewrite the same code (you may have to change the IBaction name).
Bobarino is offline   Reply With Quote
Reply

Bookmarks

Tags
cocoa touch, keyboard, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 362
16 members and 346 guests
Absentia, akphyo, apatsufas, BinHex, dre, fredidf, Gaz, gmarro, host number one, jeroenkeij, Kirkout, MarkC, mottdog, PavelMik, whitey99, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:21 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0