From e9fba18ebed9fbc5fe8489141852127cb322dced Mon Sep 17 00:00:00 2001 From: Jonathan Lott Date: Sat, 23 May 2015 10:52:26 -0500 Subject: [PATCH] moved delegate call so that lblCaption frame can be used by delegate --- WSCoachMarksView.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/WSCoachMarksView.m b/WSCoachMarksView.m index 60fc78f..b1f0cc5 100644 --- a/WSCoachMarksView.m +++ b/WSCoachMarksView.m @@ -182,11 +182,6 @@ - (void)goToCoachMarkIndexed:(NSUInteger)index { NSString *markCaption = [markDef objectForKey:@"caption"]; CGRect markRect = [[markDef objectForKey:@"rect"] CGRectValue]; - // Delegate (coachMarksView:willNavigateTo:atIndex:) - if ([self.delegate respondsToSelector:@selector(coachMarksView:willNavigateToIndex:)]) { - [self.delegate coachMarksView:self willNavigateToIndex:markIndex]; - } - // Calculate the caption position and size self.lblCaption.alpha = 0.0f; self.lblCaption.frame = (CGRect){{0.0f, 0.0f}, {self.maxLblWidth, 0.0f}}; @@ -205,6 +200,12 @@ - (void)goToCoachMarkIndexed:(NSUInteger)index { self.lblCaption.alpha = 1.0f; }]; + // call delegate here so lblCaption frame can be used by delegate + // Delegate (coachMarksView:willNavigateTo:atIndex:) + if ([self.delegate respondsToSelector:@selector(coachMarksView:willNavigateToIndex:)]) { + [self.delegate coachMarksView:self willNavigateToIndex:markIndex]; + } + // If first mark, set the cutout to the center of first mark if (markIndex == 0) { CGPoint center = CGPointMake(floorf(markRect.origin.x + (markRect.size.width / 2.0f)), floorf(markRect.origin.y + (markRect.size.height / 2.0f)));