ferhat
ferhat

Reputation: 11

How can I open modal view (formsheet) from UITableView?

I am tired try open a modal view controller from ipad application. How I can show a modal view like formsheet?

here my code block. like this style opening a window (full screen) but there is don't have any object from my modal view

viewDetail *hd = [[viewDetail alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:hd];

hd.modalPresentationStyle = UIModalPresentationFormSheet;
[self.navigationController presentModalViewController:nav animated:YES];

[hd release];
[nav release];

just i want open a formSheet modal view when selected a value from UITableView by the way, i am development on xcode 4.2.1 and usind storyboard features thanks for help.

like that give a SIGABRT error

viewDetail *hd = [[viewDetail alloc] initWithNibName:@"viewDetail" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:hd];

hd.modalPresentationStyle = UIModalPresentationFormSheet;
[self.navigationController presentModalViewController:nav animated:YES];

[hd release];
[nav release];

Upvotes: 0

Views: 759

Answers (2)

Finn Gaida
Finn Gaida

Reputation: 4040

If you're using storyboards, you have to set [self.storyboard instantiateViewControllerWithIdentifier:@"viewDetail"]; as your viewDetail View Controller. (Assuming you set the Storyboard Identifier accordingly)

hope that helps.

Upvotes: 0

ferhat
ferhat

Reputation: 11

I fixed my solution, worked a xib file out of story board. But why wasn't it working in storyboard? There is a way for that?

Upvotes: 1

Related Questions