example/ivy/ios: enable return to continue demo

Change-Id: I189cd6b4953aeb988dfb1d28662f228508d463ff
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/360379
Reviewed-by: Rob Pike <r@golang.org>
Trust: Rob Pike <r@golang.org>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/.gitignore b/.gitignore
index bdda4d0..87baa64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 .idea
 .gradle
 *.properties
+.DS_Store
 example/ivy/**/build/
 example/ivy/android/gradle/
 
diff --git a/example/ivy/ios/ivy/Base.lproj/Main.storyboard b/example/ivy/ios/ivy/Base.lproj/Main.storyboard
index 18a65a9..0300f5b 100644
--- a/example/ivy/ios/ivy/Base.lproj/Main.storyboard
+++ b/example/ivy/ios/ivy/Base.lproj/Main.storyboard
@@ -64,6 +64,10 @@
                                         <rect key="contentStretch" x="1" y="1" width="1" height="1"/>
                                         <fontDescription key="fontDescription" name="Menlo-Bold" family="Menlo" pointSize="14"/>
                                         <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet" keyboardAppearance="alert" enablesReturnKeyAutomatically="YES" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
+                                        <connections>
+                                            <action selector="okPressed:" destination="BYZ-38-t0r" eventType="primaryActionTriggered" id="3BK-xS-ize"/>
+                                            <action selector="okPressed:" destination="BYZ-38-t0r" eventType="editingDidEnd" id="91o-Gh-hrf"/>
+                                        </connections>
                                     </textField>
                                     <button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eO6-bM-CwW">
                                         <rect key="frame" x="301.5" y="0.0" width="72.5" height="31"/>
diff --git a/example/ivy/ios/ivy/IvyController.m b/example/ivy/ios/ivy/IvyController.m
index ecac33f..654961b 100644
--- a/example/ivy/ios/ivy/IvyController.m
+++ b/example/ivy/ios/ivy/IvyController.m
@@ -46,7 +46,7 @@
      selector:@selector(keyboardWillHide:)
      name:UIKeyboardWillHideNotification
      object:nil];
-    
+
     [self.input becomeFirstResponder];
     [self clear:NULL];
 }
@@ -70,18 +70,6 @@
     return YES;
 }
 
-- (BOOL)textField:(UITextField *)textField
-shouldChangeCharactersInRange:(NSRange)range
-replacementString:(NSString *)str
-{
-    if ([str isEqualToString:@"\n"]) {
-        [self enterPressed];
-        return NO;
-    }
-    
-    return YES;
-}
-
 - (void)textDidChange:(NSNotification *)notif
 {
     [self.suggestionView suggestFor:self.input.text];
@@ -101,7 +89,7 @@
     [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
     NSNumber *duration =
     [info objectForKey:UIKeyboardAnimationDurationUserInfoKey];
-    
+
     UIViewAnimationCurve keyboardTransitionAnimationCurve;
     [[info valueForKey:UIKeyboardAnimationCurveUserInfoKey]
      getValue:&keyboardTransitionAnimationCurve];
@@ -190,6 +178,7 @@
         }
         self.input.text = @"";
     }
+    [self.input becomeFirstResponder];
 }
 
 - (void)scrollTapeToBottom
@@ -210,15 +199,17 @@
 {
     [self.okButton setHidden:FALSE];
     NSString *text = DemoText();
-    
+
     self->demo_lines = [text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
     self->demo_index = 0;
     self.input.text = @"";
+    self.input.enablesReturnKeyAutomatically=TRUE;
     [self enterPressed];
 }
 - (void)unloadDemo
 {
     [self.okButton setHidden:TRUE];
+    self.input.enablesReturnKeyAutomatically=FALSE;
     self->demo_lines=NULL;
     self.input.text = @"";
 }