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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 01-21-2010, 05:44 AM   #23 (permalink)
subodh kumar
Registered Member
 
Join Date: Jul 2009
Posts: 30
Default

hi
I am using both textview and text field in single view controller.
Toolbar is showing fine upon keyboard when clicking in textview but when clicking text field again toolbar is showing upon keyboard. but i don't want toolbar in case of text field.
this is my code

- (void)keyboardWillShowNSNotification *)notification
{
for (UIWindow *keyboardWindow in [[UIApplication sharedApplication] windows]) {

// Now iterating over each subview of the available windows
for (UIView *keyboard in [keyboardWindow subviews]) {

// Check to see if the description of the view we have referenced is UIKeyboard.
// If so then we found the keyboard view that we were looking for.
if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES) {
NSValue *v = [[notification userInfo] valueForKey:UIKeyboardBoundsUserInfoKey];
CGRect kbBounds = [v CGRectValue];

mKeyboardToolbar.barStyle = UIBarStyleBlackOpaque;




UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemD one
target:self action:@selector(dismissKeyboard)];
UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemF lexibleSpace target:nil action:nil];
NSArray *items = [[NSArray alloc] initWithObjects:flex, barButtonItem, nil];
[mKeyboardToolbar setItems:items];
[items release];
[barButtonItem release];
[flex release];

[mKeyboardToolbar removeFromSuperview];
mKeyboardToolbar.frame = CGRectMake(0, 0, kbBounds.size.width, 50);
[keyboard addSubview:mKeyboardToolbar];

if(textField)
mKeyboardToolbar.hidden = YES;
else
mKeyboardToolbar.hidden = NO;


keyboard.bounds = CGRectMake(kbBounds.origin.x, kbBounds.origin.y , kbBounds.size.width, kbBounds.size.height + 100);

for(UIView* subKeyboard in [keyboard subviews]) {
if([[subKeyboard description] hasPrefix:@"<UIKeyboardImpl"] == YES) {
subKeyboard.bounds = CGRectMake(kbBounds.origin.x, kbBounds.origin.y -50, kbBounds.size.width, kbBounds.size.height);
}
}
}
}
}

}
subodh kumar is offline   Reply With Quote
 

» Advertisements
» Online Users: 513
17 members and 496 guests
Dani77, dljeffery, gabacus, GameViewPoint, genialapps, JasonR, mediaspree, Punkjumper, rky, Rudy, sporting247, themathminister, tsai0507, TTStu, WhiteWidget, youngdeveloper
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,751
Threads: 89,202
Posts: 380,572
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jadebair24
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:01 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.