Permalink
Browse files

final

  • Loading branch information...
PRO100MIXA committed Jun 17, 2012
0 parents commit 5a12055ef45cd5f09fd24b502841900834a037f4
BIN .DS_Store
Binary file not shown.
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>Test.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'Magic E-Send' target in the 'Magic E-Send' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_4_0
+#warning "This project uses features only available in iOS SDK 4.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,19 @@
+//
+// MagicE_SendAppDelegate.h
+// Magic E-Send
+//
+// Created by Mikhael on 17.06.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class MagicE_SendViewController;
+
+@interface MagicE_SendAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@property (strong, nonatomic) MagicE_SendViewController *viewController;
+
+@end
@@ -0,0 +1,55 @@
+//
+// MagicE_SendAppDelegate.m
+// Magic E-Send
+//
+// Created by Mikhael on 17.06.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "MagicE_SendAppDelegate.h"
+
+#import "MagicE_SendViewController.h"
+
+@implementation MagicE_SendAppDelegate
+
+@synthesize window = _window;
+@synthesize viewController = _viewController;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ // Override point for customization after application launch.
+ self.viewController = [[MagicE_SendViewController alloc] initWithNibName:@"MagicE_SendViewController" bundle:nil];
+ self.window.rootViewController = self.viewController;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
@@ -0,0 +1,24 @@
+//
+// MagicE_SendViewController.h
+// Magic E-Send
+//
+// Created by Mikhael on 17.06.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <MessageUI/MFMailComposeViewController.h>
+
+@interface MagicE_SendViewController : UIViewController
+<UIPickerViewDataSource, UIPickerViewDelegate, MFMailComposeViewControllerDelegate> {
+ UIPickerView *emailPicker_;
+ NSArray *activites_;
+ NSArray *feelings_;
+ UITextField *notesField_;
+}
+- (IBAction)sendButtonTapped:(id)sender;
+@property (retain, nonatomic) IBOutlet UIPickerView *emailPicker;
+@property (retain, nonatomic) IBOutlet UITextField *notesField;
+- (IBAction)textFieldDoneEditing:(id)sender;
+
+@end
@@ -0,0 +1,98 @@
+//
+// MagicE_SendViewController.m
+// Magic E-Send
+//
+// Created by Mikhael on 17.06.12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "MagicE_SendViewController.h"
+@interface MagicE_SendViewController ()
+
+@end
+
+@implementation MagicE_SendViewController
+@synthesize emailPicker=emailPicker_;
+@synthesize notesField=notesField_;
+
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ activites_ = [[NSArray alloc] initWithObjects:@"сижу на унитазе", @"сплю", @"ем", @"работаю", @"думаю", @"пишу", @"путешествую", @"бегаю", @"мечтаю", @"учу", nil];
+ feelings_ = [[NSArray alloc] initWithObjects:@"расслабление", @"удивление", @"печаль", @"счастье", @"сомнение", @"надежду", @"спокойствие", @"злость", @"стресс", @"любовь", nil];
+ // Do any additional setup after loading the view, typically from a nib.
+}
+
+-(IBAction)textFieldDoneEditing:(id)sender
+{
+ [sender resignFirstResponder];
+}
+
+#pragma mark -
+#pragma mark Picker Data Source Protocol
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
+{
+ return 2;
+}
+
+-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
+{
+ if (component == 0) {
+ return [activites_ count];
+ }
+ else {
+ return [feelings_ count];
+ }
+}
+
+#pragma mark -
+#pragma mark Picker Delegate Protocol
+-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
+{
+ if (component == 0) {
+ return [activites_ objectAtIndex:row];
+ } else {
+ return [feelings_ objectAtIndex:row];
+ }
+ return nil;
+}
+
+-(IBAction)sendButtonTapped:(id)sender
+{
+ NSString* theMessage = [NSString stringWithFormat:@"%@ Я %@ и чувствую %@!", notesField_.text ?notesField_.text:@"",[activites_ objectAtIndex:[emailPicker_ selectedRowInComponent:0]],[feelings_ objectAtIndex:[emailPicker_ selectedRowInComponent:1]]];
+ NSLog(@"%@",theMessage);
+ if ([MFMailComposeViewController canSendMail]) {
+ MFMailComposeViewController* mailController = [[MFMailComposeViewController alloc] init];
+ mailController.mailComposeDelegate = self;
+ [mailController setToRecipients:[[NSArray alloc] initWithObjects: @"carolina58@yandex.ru", @"mixail.exe@gmail.com", nil]];
+ [mailController setSubject:@"Hello!!!"];
+ [mailController setMessageBody:theMessage isHTML:NO];
+ [self presentModalViewController:mailController animated:YES];
+ } else {
+ NSLog(@"Необходим настроенный аккаунт электронной почты");
+ }
+}
+
+-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
+ [self dismissModalViewControllerAnimated:YES];
+}
+
+- (void)viewDidUnload
+{
+ [self setEmailPicker:nil];
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+}
+
+/*- (void)dealloc{
+ [activites_ release];
+ [feelings_ release];
+ [super dealloc];
+ }*/
+@end
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
Oops, something went wrong.

0 comments on commit 5a12055

Please sign in to comment.