开发者

problem in loading a model View

I have written a code for mail application like:

{
  MFMailComposeViewController *picker=[MFM开发者_如何学运维ailComposeViewController alloc] init];
  .........
  .........
  [self.navigationController pushViewController:picker.view animated:YES]; 
}

The view is not getting loaded.Is is mandatory to write

[self presentModalViewController:picker animated:YES];

because when I write the above line it works perfectly fine.


do you actually have a navigation controller? You need to give more background information like what the class's superclass that contains the code you posted is. presenting a view modally and in a navigation stack is very different.

A modal view slides up from the bottom of the screen and fills the entire screen so that you can only do the one action that view lets (it hides things like navigation bars and tab bars) (like adding a new event in the calendar app)

a navigation controller is most commonly used with table views and slides the old view off to the left and the new view on from the right (like the settings app)

From the look of the code you posted you are wanting to present the View modally and you don't need the line where you push the view onto the screen using a navigation controller (which I'm guessing doesn't exist?)

ALSO: This line of code is incorrect anyway:

[self.navigationController pushViewController:picker.view animated:YES];

presentModalViewController asks for a viewcontroller not a UIView. So you need to remove the .view after picker.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜