05-06-2011, 04:09 PM
#1 (permalink )
Registered Member
Join Date: Nov 2010
Posts: 19
UIModalFormSheet Dismiss UITextField Keyboard
Hello.
Does anybody know how to dismiss a keyboard when using UIModalFormSheet?
I dont wan't to change the modalPresentationStyle to something else so i have been trying to figure out how to dismiss it.
Regards
Toby...
05-06-2011, 07:53 PM
#2 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Quote:
Originally Posted by
tobyaherbert
Hello.
Does anybody know how to dismiss a keyboard when using UIModalFormSheet?
I dont wan't to change the modalPresentationStyle to something else so i have been trying to figure out how to dismiss it.
Regards
Toby...
Had the same issue. Apple designed it like that because it is a Form sheet, so the keyboard would be the main use. I ended up doing a fullscreen modal and just resized the view.
__________________
Haters gonna Hate
Likers gonna Like
05-06-2011, 07:54 PM
#3 (permalink )
Beast Mode
Join Date: Dec 2008
Age: 21
Posts: 1,971
Quote:
Originally Posted by
Bertrand21
Had the same issue. Apple designed it like that because it is a Form sheet, so the keyboard would be the main use. I ended up doing a fullscreen modal and just resized the view.
Heres the code:
Code:
FoodViewController *viewController = [[FoodViewController alloc] initWithNibName:@"FoodViewController" bundle:nil];
viewController.delegate = self;
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:viewController];
controller.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:controller animated:YES];
controller.view.superview.autoresizingMask =
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin;
controller.view.superview.frame = CGRectMake(
controller.view.superview.frame.origin.x,
controller.view.superview.frame.origin.y,
540.0f,
620.0f
);
controller.view.superview.center = self.view.center;
[controller release];
[viewController release];
__________________
Haters gonna Hate
Likers gonna Like
05-07-2011, 09:18 AM
#4 (permalink )
Registered Member
Join Date: Nov 2010
Posts: 19
UIModalFormSheet Dismiss UITextField Keyboard
Thanks Bertrand21.
I am now using that code but with a small change because it dosen't work in landscape mode.
Code:
UIInterfaceOrientation interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
panelNavController = [[UINavigationController alloc] initWithRootViewController:panelContentViewController];
[panelNavController setDelegate:self];
[panelNavController setModalPresentationStyle:UIModalPresentationPageSheet];
[panelNavController setModalTransitionStyle:panelTransitionStyle];
[panelPresentingViewController presentModalViewController:panelNavController animated:animatesPresentation];
[panelNavController.view.superview setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin];
[panelNavController.view.superview setFrame:CGRectMake(0.0f, 0.0f, panelWidth, panelHeight)];
[panelNavController.view.superview setCenter:CGPointMake(384, 512)];
[panelNavController release];
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
panelNavController = [[UINavigationController alloc] initWithRootViewController:panelContentViewController];
[panelNavController setDelegate:self];
[panelNavController setModalPresentationStyle:UIModalPresentationPageSheet];
[panelNavController setModalTransitionStyle:panelTransitionStyle];
[panelPresentingViewController presentModalViewController:panelNavController animated:animatesPresentation];
[panelNavController.view.superview setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin];
[panelNavController.view.superview setFrame:CGRectMake(0.0f, 0.0f, panelWidth, panelHeight)];
[panelNavController.view.superview setCenter:CGPointMake(512, 384)];
[panelNavController release];
}
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 354
10 members and 344 guests
dansparrow , iOS.Lover , lorrettaui53 , MikaelBartlett , Nobbsy , oztemel , pbart , PlutoPrime , thephotographer , Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44