繁体   English   中英

如何在Landscape iPhone应用中运行电子邮件/短信?

[英]How to run email/sms in landscape iPhone app?

我有一个iPhone应用程序,仅在横向模式下运行,但是最近我想添加邮件/短信/ facebook功能(通过UIButton操作)。 最后一个运行平稳,我启动了网络浏览器(它自己管理人像模式),但是启动邮件或短信作曲家却让我发疯。 我只想仅在横向模式下使用此应用程序,但不包括启动mail / sms / fb(实际上是浏览器)。

当应用程序屏幕横向放置时,我设法使纵向的邮件/短信编辑器处于垂直模式,但是键盘也横向出现,这阻塞了编辑器的左/右一半-使用[composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];

我是在阅读有关此主题的坏东西,还是我只是盲目;)-无论哪种方式,都需要任何帮助,谢谢

编辑:

我有一个覆盖的根ViewController:

- (BOOL)shouldAutorotateToInterfaceOrientation

在两种横向模式下均返回“是”。 这个rootVC启动了ShareVC,它具有3个用于mail / sms / fb的按钮。 我希望实现启动网页浏览器之类的功能,该功能从纵向开始。 与邮件和短信相同,但使用模式视图控制器,然后在发送邮件/短信后返回ShareVC ...
我还将plist中的方向设置为横向模式。 希望这可以澄清我要做什么:)

尝试将其添加到所需的ViewController中:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  return interfaceOrientation==UIInterfaceOrientationLandscapeLeft;
}

我附近没有Mac,因此可能有错误。

希望能帮助到你

解决的问题:)事实证明,我是在childVC而不是rootVC本身上调用present / dismiss modalViewController,这是代码段:

-(IBAction)goMail{
    NSLog(@"gomail...");
    MFMailComposeViewController *picker = [[[MFMailComposeViewController alloc] init] autorelease];
    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];

    if ([MFMailComposeViewController canSendMail]) {
        picker.mailComposeDelegate = self;
        [picker setSubject:@"Hello iPhone!"];

        // Set up recipients
        NSArray *toRecipients = [NSArray arrayWithObject:@"aa@bb.com"];
        [picker setToRecipients:toRecipients];
        [picker setMessageBody:@"mail content..." isHTML:NO];
        [self.controller presentModalViewController:picker animated:YES];
        //[picker release];
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM