有许多方法来替代,比如initWithNibname:,awakeFromNib,loadView,viewDidLoad,viewDidAppear:,layoutSubviews,我只是不能决定其中为了获得这些方法调用.
我只是"用心"覆盖其中一个.
任何详细的解释?
我试图编写rhodes本机扩展扩展来打开iOS MailComposer.现在代码"工作",但MFMailComposeViewController没有显示,xcode显示警告:
Attempt to present <MFMailComposeViewController: 0x12b60840> on <Iosmailto: 0xc1898d0> whose view is not in the window hierarchy!
Run Code Online (Sandbox Code Playgroud)
我读到UIViewControllers必须在层次结构中,但我不能从Rhodes ruby代码或clear-C扩展包装器中提供.现在我正在尝试使用来自[UIApplication sharedApplication] .keyWindow.rootViewController的MFMailComposeController呈现我的UIViewController,但邮件编辑器尚未显示.
来自iosmailto.h的界面:
@interface Iosmailto : UIViewController<MFMailComposeViewControllerDelegate>
{
}
@property(nonatomic, assign) id delegate;
//-(IBAction)send_mail:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
从iosmailto.m实现:
@implementation Iosmailto
- (void)viewDidLoad {
[super viewDidLoad];
[self send_mail];
}
- (void)send_mail {
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
composer.mailComposeDelegate = self;
[composer setSubject:[NSString stringWithUTF8String:subj]];
NSArray *recipients_array = [NSArray arrayWithObject:[NSString stringWithUTF8String:recipients]]; …Run Code Online (Sandbox Code Playgroud) iphone uiviewcontroller rhomobile ios mfmailcomposeviewcontroller