【问题标题】:MFMailComposeViewController custom navigation buttons?MFMailComposeViewController 自定义导航按钮?
【发布时间】:2011-07-06 18:39:08
【问题描述】:

MFMailComposeViewController 中的“取消”和“发送”按钮 (barbuttonitems) 使用自定义背景图像的最佳方式是什么?

A/N:我知道 Apple 网站上关于不更改 interfact 的说明,但我需要这样做以确保整个应用程序的一致性。

【问题讨论】:

    标签: ios ios4 mfmailcomposeviewcontroller


    【解决方案1】:

    您始终可以在后台发送电子邮件并控制表单和电子邮件按钮的外观。看看这篇文章以及如何做到这一点的答案。

    Locking the Fields in MFMailComposeViewController

    【讨论】:

      【解决方案2】:

      您可以通过应用委托自定义导航栏、取消和发送按钮的外观。

      试试这个代码:

      UIImage*resizedImage = [[UIImage imageNamed:@"navbar1"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 12, 12, 10)];
      id navbar =[UINavigationBar appearance];
      id barbutton =[UIBarButtonItem appearance];
      
      //this customises the navigation bar 
      [navbar setBackgroundImage:resizedImage forBarMetrics:UIBarMetricsDefault];
      UIImage *backButton = [[UIImage imageNamed:@"blueButton"]  resizableImageWithCapInsets:UIEdgeInsetsMake(10 , 18, 10 , 18)];
      
      // this customises the back bar button item in the navigation bar
      [barbutton setBackButtonBackgroundImage:backButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
      
      
      // this for other bar button items 
      [barbutton setBackgroundImage:backButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
      

      【讨论】:

      • 这适用于一个例外:似乎 MFMailComposeViewController 忽略了 resizingMode 参数:[[UIBarButtonItem appearance] setBackgroundImage:[[UIImage imageNamed:@"btn-main.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(4.0, 4.0, 4.0, 4.0) resizingMode:UIImageResizingModeStretch] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
      猜你喜欢
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多