From efaf9afb2794116bc79e226e5ced51e95d3d3b2a Mon Sep 17 00:00:00 2001
From: Dima4ka <dima4ka007@gmail.com>
Date: Wed, 9 Apr 2014 02:26:54 -0400
Subject: [PATCH] Automated keyboard appearance added
---
.../Base.lproj/Main.storyboard | 7 ++---
.../WPIFriendViewController.m | 9 +++++++
.../WPIMissingBuildingViewController.m | 5 ++++
.../WPIMissingProfessorViewController.m | 6 +++++
WPI Calendar Event Creator/WPIModel.m | 26 +++++++++++++------
.../WPINotesViewController.m | 5 ++++
.../WPIRoomViewController.m | 6 +++++
.../WPITableViewController.m | 2 ++
8 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/WPI Calendar Event Creator/Base.lproj/Main.storyboard b/WPI Calendar Event Creator/Base.lproj/Main.storyboard
index 522ab6c..296aff6 100644
--- a/WPI Calendar Event Creator/Base.lproj/Main.storyboard
+++ b/WPI Calendar Event Creator/Base.lproj/Main.storyboard
@@ -424,6 +424,7 @@
<outlet property="notesCell" destination="w5F-k8-fu6" id="hjd-mU-7kO"/>
<outlet property="notesCellSubtitleLabel" destination="jnc-UL-L4a" id="3s8-J8-ktN"/>
<outlet property="segmentedCell" destination="hKt-ue-2Ex" id="xRh-7A-851"/>
+ <outlet property="segmentedControll" destination="dh2-zX-vdz" id="USm-lD-uz4"/>
<segue destination="ZH9-7k-a96" kind="push" identifier="TypeToFriendSegue" id="ON9-Of-yNd"/>
<segue destination="WCo-rf-QLU" kind="push" identifier="TypeToCustomSegue" id="BNU-uE-JBB"/>
<segue destination="izA-I5-AI8" kind="push" identifier="TypeToProfessorSegue" id="SuI-1w-32F"/>
@@ -722,7 +723,7 @@
<action selector="writeEmail:" destination="fzL-WR-GQj" eventType="touchUpInside" id="rGf-Yu-ufH"/>
</connections>
</button>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Write email to developer about professor building" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="Ivl-W4-T18">
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Write email to developer about missing professor" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="280" translatesAutoresizingMaskIntoConstraints="NO" id="Ivl-W4-T18">
<rect key="frame" x="20" y="214" width="280" height="47"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
@@ -1023,7 +1024,7 @@
<color key="backgroundColor" red="0.0" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/>
+ <textInputTraits key="textInputTraits" autocapitalizationType="allCharacters" enablesReturnKeyAutomatically="YES"/>
<connections>
<outlet property="delegate" destination="EuZ-uN-7jh" id="YEV-pP-pWO"/>
</connections>
@@ -2017,7 +2018,7 @@ AQABAAEAAQAB//+dkAEA//+PgAAE//+dkAEI//+dkAEMUERUAFBTVABQV1QAUFBUAAAAAAEAAAABA
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
<inferredMetricsTieBreakers>
+ <segue reference="axh-4G-zRI"/>
<segue reference="a1q-7a-6BE"/>
- <segue reference="h2T-3x-Eyw"/>
</inferredMetricsTieBreakers>
</document>
diff --git a/WPI Calendar Event Creator/WPIFriendViewController.m b/WPI Calendar Event Creator/WPIFriendViewController.m
index 74c576b..f51e539 100644
--- a/WPI Calendar Event Creator/WPIFriendViewController.m
+++ b/WPI Calendar Event Creator/WPIFriendViewController.m
@@ -29,6 +29,15 @@
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+
+}
+
+-(void)viewDidAppear:(BOOL)animated {
+ if ([(NSNumber*)[[WPIModel sharedDataModel].data valueForKey:@"Type"] integerValue] == 1) {
+ [self.textField becomeFirstResponder];
+ } else {
+ [self.textView becomeFirstResponder];
+ }
}
-(void) viewWillDisappear:(BOOL)animated {
diff --git a/WPI Calendar Event Creator/WPIMissingBuildingViewController.m b/WPI Calendar Event Creator/WPIMissingBuildingViewController.m
index 119662f..99d7282 100644
--- a/WPI Calendar Event Creator/WPIMissingBuildingViewController.m
+++ b/WPI Calendar Event Creator/WPIMissingBuildingViewController.m
@@ -32,10 +32,15 @@
[model.data setObject:[NSNumber numberWithBool:YES] forKey:@"Use Custom Building"];
}
+-(void)viewDidAppear:(BOOL)animated {
+ [self.buildingName becomeFirstResponder];
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+
}
- (void)didReceiveMemoryWarning
diff --git a/WPI Calendar Event Creator/WPIMissingProfessorViewController.m b/WPI Calendar Event Creator/WPIMissingProfessorViewController.m
index a551246..2d04874 100644
--- a/WPI Calendar Event Creator/WPIMissingProfessorViewController.m
+++ b/WPI Calendar Event Creator/WPIMissingProfessorViewController.m
@@ -31,6 +31,12 @@
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+
+
+}
+
+-(void)viewDidAppear:(BOOL)animated {
+ [self.textField becomeFirstResponder];
}
-(void) viewWillDisappear:(BOOL)animated {
diff --git a/WPI Calendar Event Creator/WPIModel.m b/WPI Calendar Event Creator/WPIModel.m
index 0ff4d0f..a89359a 100644
--- a/WPI Calendar Event Creator/WPIModel.m
+++ b/WPI Calendar Event Creator/WPIModel.m
@@ -308,7 +308,7 @@ static WPIModel *sharedDataModel = nil;
NSError* error;
- [self.eventStore saveEvent:event span:EKSpanThisEvent error:&error];
+ //[self.eventStore saveEvent:event span:EKSpanThisEvent error:&error];
@@ -318,8 +318,8 @@ static WPIModel *sharedDataModel = nil;
[self configureData];
} else {
if ([(NSNumber*)[self.data valueForKey:@"Use Custom Professor"] boolValue]) {
- alert = [[UIAlertView alloc] initWithTitle:@"Your event" message:@"Your event is successfully added to your default calendar." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
- [self configureData];
+ alert = [[UIAlertView alloc] initWithTitle:@"Your event" message:@"Your event is successfully added to your default calendar. Would you like to send out an email with this event?" delegate:self cancelButtonTitle:@"No" otherButtonTitles: @"Yes", nil];
+ //[self configureData];
} else {
NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]];
NSString *message = [NSString stringWithFormat:@"Your event is successfully added to your default calendar. Would you like to send an email to professor %@ with a reminder? You will confirm it.", [prof objectForKey:@"Name"]];
@@ -358,13 +358,23 @@ static WPIModel *sharedDataModel = nil;
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self.mainTable;
+
+ NSString *message = @"";
- NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]];
- NSString *email = [prof valueForKey:@"Email"];
+ if (![(NSNumber*)[self.data valueForKey:@"Use Custom Professor"] boolValue]) {
+
+ NSDictionary *prof = (NSDictionary*)[self.professors objectAtIndex:[(NSNumber*)[self.data valueForKey:@"Professor's Index"] integerValue]];
+ NSString *email = [prof valueForKey:@"Email"];
+
+ [mailViewController setToRecipients:@[email]];
+ [mailViewController setSubject:@"Appointment reminder"];
+ message = [NSString stringWithFormat:@"Dear Professor %@:\n\n I am just writing you a reminder about an appointment we set on %@. \n\n Thank you!", [prof valueForKey:@"Name"], [self getDateForPurpose:4]];
+ } else {
+ [mailViewController setSubject:[self getTitleForPurpose:1]];
+ }
+
+ message = [message stringByAppendingString:[NSString stringWithFormat:@"\n\nAttached is an event file. You may add this event to your calendar.\n\n(This is an automated email from WPI Calendar Events Creator app)\n"]];
- [mailViewController setToRecipients:@[email]];
- [mailViewController setSubject:@"Appointment reminder"];
- NSString *message = [NSString stringWithFormat:@"Dear Professor %@:\n\n I am just writing you a reminder about an appointment we set on %@. \n\n Thank you!\n\n(This is an automated email from WPI Calendar Events Creator app)\n", [prof valueForKey:@"Name"], [self getDateForPurpose:4]];
[mailViewController setMessageBody:message isHTML:NO];
diff --git a/WPI Calendar Event Creator/WPINotesViewController.m b/WPI Calendar Event Creator/WPINotesViewController.m
index 9c921e2..ee3a8b9 100644
--- a/WPI Calendar Event Creator/WPINotesViewController.m
+++ b/WPI Calendar Event Creator/WPINotesViewController.m
@@ -36,6 +36,11 @@
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+
+}
+
+-(void)viewDidAppear:(BOOL)animated {
+ [self.notesTextField becomeFirstResponder];
}
- (void)didReceiveMemoryWarning
diff --git a/WPI Calendar Event Creator/WPIRoomViewController.m b/WPI Calendar Event Creator/WPIRoomViewController.m
index f07c407..baab2ce 100644
--- a/WPI Calendar Event Creator/WPIRoomViewController.m
+++ b/WPI Calendar Event Creator/WPIRoomViewController.m
@@ -41,11 +41,17 @@
[model.data setValue:self.specificPlaceTextField.text forKey:@"Specific Place"];
}
+-(void)viewDidAppear:(BOOL)animated {
+ [self.roomNumberTextField becomeFirstResponder];
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
+
+
UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.barStyle = UIBarStyleDefault;
numberToolbar.items = [NSArray arrayWithObjects:
diff --git a/WPI Calendar Event Creator/WPITableViewController.m b/WPI Calendar Event Creator/WPITableViewController.m
index 6832f80..e17902b 100644
--- a/WPI Calendar Event Creator/WPITableViewController.m
+++ b/WPI Calendar Event Creator/WPITableViewController.m
@@ -18,6 +18,7 @@
@property (weak, nonatomic) IBOutlet UILabel *buildingCellSubtitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *alertCellSubtitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *notesCellSubtitleLabel;
+@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentedControll;
@property (weak, nonatomic) IBOutlet UILabel *dateCellConflictLabel;
- (IBAction)favoritesButtonPressed:(id)sender;
@@ -131,6 +132,7 @@
-(void)configureDetailsCell {
WPIModel *model = [WPIModel sharedDataModel];
+ [self.segmentedControll setSelectedSegmentIndex:[(NSNumber*)[model.data valueForKey:@"Type"] integerValue]];
switch ([(NSNumber*)[model.data valueForKey:@"Type"] integerValue]) {
case 0:
self.detailsCellMainLabel.text = @"Professor...";
--
GitLab