我正在开发一个应用程序,但我错过了一小部分。我准备了一个视图,以便您可以将数据插入 UITextField,然后我可以通过电子邮件发送此信息。我尝试了很多方法。
#import <UIKit/UIKit.h>
@interface RMAcpu : UIViewController <UITextFieldDelegate>
@property IBOutlet UITextField *prodotto;
@property IBOutlet UITextField *seriale;
@property IBOutlet UITextField *cfiva;
@property IBOutlet UITextField *email;
@property IBOutlet UITextField *problema;
- (IBAction)inviodati:(id)sender;
@end
关于.m,我试过了,但没有发送信息。你能帮我通过电子邮件发送信息吗?
#import "RMAcpu.h"
@interface RMAcpu ()
@end
@implementation RMAcpu
@synthesize prodotto;
@synthesize seriale;
@synthesize cfiva;
@synthesize email;
@synthesize problema;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewDidUnload
{
[self setProdotto:nil];
[self setSeriale:nil];
[self setCfiva:nil];
[self setEmail:nil];
[self setProblema:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)inviodati:(id)sender {
NSString *stringaMail = [NSString stringWithFormat:@"mailto:cristian@prokoo.com", [[prodotto text] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding], [[seriale text] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding], [[cfiva text] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:stringaMail]];
}
@end