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 05-06-2011, 04:09 PM   #1 (permalink)
Registered Member
 
tobyaherbert's Avatar
 
Join Date: Nov 2010
Posts: 19
tobyaherbert is on a distinguished road
Post 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...
tobyaherbert is offline   Reply With Quote
Old 05-06-2011, 07:53 PM   #2 (permalink)
Beast Mode
 
Join Date: Dec 2008
Age: 21
Posts: 1,971
Bertrand21 is on a distinguished road
Default

Quote:
Originally Posted by tobyaherbert View Post
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
Bertrand21 is offline   Reply With Quote
Old 05-06-2011, 07:54 PM   #3 (permalink)
Beast Mode
 
Join Date: Dec 2008
Age: 21
Posts: 1,971
Bertrand21 is on a distinguished road
Default

Quote:
Originally Posted by Bertrand21 View Post
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
Bertrand21 is offline   Reply With Quote
Old 05-07-2011, 09:18 AM   #4 (permalink)
Registered Member
 
tobyaherbert's Avatar
 
Join Date: Nov 2010
Posts: 19
tobyaherbert is on a distinguished road
Smile 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];
    }
tobyaherbert is offline   Reply With Quote
Reply

Bookmarks

Tags
dismiss, form, keyboard, modal, sheet

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: 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
Powered by vBadvanced CMPS v3.1.0

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