File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -462,4 +462,7 @@ NS_CLASS_AVAILABLE_IOS(7_0) @interface SLKTextViewController : UIViewController
462
462
/* * UIGestureRecognizerDelegate */
463
463
- (BOOL )gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer NS_REQUIRES_SUPER;
464
464
465
+ /* * UIAlertViewDelegate */
466
+ - (void )alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger )buttonIndex NS_REQUIRES_SUPER;
467
+
465
468
@end
Original file line number Diff line number Diff line change 24
24
NSString * const SLKKeyboardWillHideNotification = @" SLKKeyboardWillHideNotification" ;
25
25
NSString * const SLKKeyboardDidHideNotification = @" SLKKeyboardDidHideNotification" ;
26
26
27
+ NSInteger const SLKAlertViewClearTextTag = 1534347677 ; // absolute hash of 'SLKTextViewController' string
28
+
27
29
@interface SLKTextViewController ()
28
30
{
29
31
CGPoint _scrollViewOffsetBeforeDragging;
@@ -866,6 +868,7 @@ - (void)willRequestUndo
866
868
[alert addButtonWithTitle: NSLocalizedString(@" Undo" , nil )];
867
869
[alert addButtonWithTitle: NSLocalizedString(@" Cancel" , nil )];
868
870
[alert setCancelButtonIndex: 1 ];
871
+ [alert setTag: SLKAlertViewClearTextTag];
869
872
[alert setDelegate: self ];
870
873
[alert show ];
871
874
}
@@ -1816,9 +1819,8 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gesture
1816
1819
1817
1820
- (void )alertView : (UIAlertView *)alertView clickedButtonAtIndex : (NSInteger )buttonIndex
1818
1821
{
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
1822
1824
[self .textView slk_clearText: NO ];
1823
1825
}
1824
1826
}
You can’t perform that action at this time.
0 commit comments