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 01-21-2010, 04:44 AM   #23 (permalink)
subodh kumar
Registered Member
 
Join Date: Jul 2009
Posts: 29
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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,261
Threads: 39,058
Posts: 171,278
Top Poster: smasher (2,575)
Welcome to our newest member, SomeRandomNerd
Powered by vBadvanced CMPS v3.1.0

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