tags:

views:

54

answers:

2

hi all, i am created Universal application, in that i used UIModalPresentationFull, for displaying MFMailComposerSheet in iPad, which helps me to show the full screen of a MailComposer view in landscape view of ipad. When i run the application in ipad simulator i works well. If i set it to iPhone simulator 3.0 or 3.1.3 it shows the error like "error: 'UIModalPresentationFullScreen' undeclared (first use in this function)" when i comment it and run in iPhone simulator it works what would be the solution for this error or, else is that any method replaces "UIModalPresentationFull" works in both ipad and iphone?

Thanks and regards Venkat

A: 

UIModalPresentationFullScreen is only available in the 3.2 (and above) SDK so you can't compile it with a SDK lower than that.

However, you don't need to for a universal application - you compile it against the highest SDK you are going to run on and then you have to check at run-time if the methods / classes you are using are available. You set this in your build settings : Base SDK should be set to the highest SDK you are using (probably 3.2 for the iPad) and iPhone OS Deployment Target should be set to 3.0 - the lowest SDK on which your code can run.

You should be doing this each time you use a 3.2 only bit of code :

if ([controller respondsToSelector:@selector(setModalPresentationStyle:)])
    [controller setModalPresentationStyle:UIModalPresentationFullScreen];

Then, even though you have compiled against the 3.2 SDK, when you run it on lower SDK devices, this method will not be run.

I test this on an iphone that still has 3.0 SDK on it. I don't know exactly how you would test in the simulator with a lower SDK sorry.

deanWombourne
MR deanWombourne here my code i dont know how to implement above code please. "MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;NSString*emailSubject=NSLocalizedString(@"email_subject",@""); [picker setSubject:emailSubject]; NSString *emailBody =NSLocalizedString(@"email_body",@""); [picker setMessageBody:emailBody isHTML:YES]; picker.modalPresentationStyle=UIModalPresentationFullScreen; [self presentModalViewController:picker animated:YES]; picker.navigationBar.tintColor=UIColorFromRGB(0x003399); [picker release];
venkat
Sorry I haven't replied, I've been on holiday! Did you get it to work?
deanWombourne
A: 
enter code here

Using conditional compilation block we can isolate the process for iPhone and iPad

" #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200 "

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    // The device is an iPad running iPhone 3.2 or later.
    if ([picker respondsToSelector:@selector(setModalPresentationStyle:)])
    {
        //picker.modalPresentationStyle = UIModalPresentationFullScreen;
        [picker setModalPresentationStyle:UIModalPresentationFullScreen];

    }
}

" #endif "

Please remove the quotes and use that if and else part too...(i.e)conditional compilation block

venkat