File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -462,4 +462,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
462462/* * UIGestureRecognizerDelegate */
463463- (BOOL )gestureRecognizerShouldBegin : (UIGestureRecognizer *)gestureRecognizer NS_REQUIRES_SUPER;
464464
465+ /* * UIAlertViewDelegate */
466+ - (void )alertView : (UIAlertView *)alertView clickedButtonAtIndex : (NSInteger )buttonIndex NS_REQUIRES_SUPER;
467+
465468@end
Original file line number Diff line number Diff line change 2424NSString * const SLKKeyboardWillHideNotification = @" SLKKeyboardWillHideNotification" ;
2525NSString * const SLKKeyboardDidHideNotification = @" SLKKeyboardDidHideNotification" ;
2626
27+ NSInteger const SLKAlertViewClearTextTag = 1534347677 ; // absolute hash of 'SLKTextViewController' string
28+
2729@interface SLKTextViewController ()
2830{
2931 CGPoint _scrollViewOffsetBeforeDragging;
@@ -866,6 +868,7 @@ - (void)willRequestUndo
866868 [alert addButtonWithTitle: NSLocalizedString(@" Undo" , nil )];
867869 [alert addButtonWithTitle: NSLocalizedString(@" Cancel" , nil )];
868870 [alert setCancelButtonIndex: 1 ];
871+ [alert setTag: SLKAlertViewClearTextTag];
869872 [alert setDelegate: self ];
870873 [alert show ];
871874}
@@ -1816,9 +1819,8 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gesture
18161819
18171820- (void )alertView : (UIAlertView *)alertView clickedButtonAtIndex : (NSInteger )buttonIndex
18181821{
1819- if (self.shakeToClearEnabled && buttonIndex != [alertView cancelButtonIndex ] ) {
1820-
1821- // Clears the text and but not the undo manager
1822+ if (alertView.tag == SLKAlertViewClearTextTag && self.shakeToClearEnabled && buttonIndex != [alertView cancelButtonIndex ] ) {
1823+ // Clears the text but doesn't clear the undo manager
18221824 [self .textView slk_clearText: NO ];
18231825 }
18241826}
You can’t perform that action at this time.
0 commit comments