From 7ee3ca4bb90411a1727eeaa148ef08529355949e Mon Sep 17 00:00:00 2001 From: Kim Wittenburg Date: Sun, 7 Sep 2014 16:49:36 +0200 Subject: [PATCH] Added Target-Action --- MathPad/MPExpressionView.h | 3 +++ MathPad/MPExpressionView.m | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/MathPad/MPExpressionView.h b/MathPad/MPExpressionView.h index 8102634..97f6cc3 100644 --- a/MathPad/MPExpressionView.h +++ b/MathPad/MPExpressionView.h @@ -25,4 +25,7 @@ @property (nonatomic, getter = isEditable) BOOL editable; @property (nonatomic, strong) MPRangePath *selection; +@property (nonatomic, weak) id target; +@property (nonatomic) SEL action; + @end diff --git a/MathPad/MPExpressionView.m b/MathPad/MPExpressionView.m index b15f4fc..bd669cb 100644 --- a/MathPad/MPExpressionView.m +++ b/MathPad/MPExpressionView.m @@ -275,6 +275,15 @@ } } +- (void)insertNewline:(id)sender +{ + if (self.target && self.action) { + [self.target performSelector:self.action + withObject:self + afterDelay:0.0]; + } +} + - (void)moveRight:(id)sender { if (self.selection.length > 0) {