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>
This commit is contained in:
robaho 2021-11-01 14:38:25 -05:00 коммит произвёл Rob Pike
Родитель 170e11ba23
Коммит 2ab7fee9df
3 изменённых файлов: 11 добавлений и 15 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -10,6 +10,7 @@ last-change
.idea
.gradle
*.properties
.DS_Store
example/ivy/**/build/
example/ivy/android/gradle/

Просмотреть файл

@ -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"/>

Просмотреть файл

@ -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 @@ replacementString:(NSString *)str
[[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
NSNumber *duration =
[info objectForKey:UIKeyboardAnimationDurationUserInfoKey];
UIViewAnimationCurve keyboardTransitionAnimationCurve;
[[info valueForKey:UIKeyboardAnimationCurveUserInfoKey]
getValue:&keyboardTransitionAnimationCurve];
@ -190,6 +178,7 @@ replacementString:(NSString *)str
}
self.input.text = @"";
}
[self.input becomeFirstResponder];
}
- (void)scrollTapeToBottom
@ -210,15 +199,17 @@ replacementString:(NSString *)str
{
[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 = @"";
}