Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved delegate call so that lblCaption frame can be used by delegate #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions WSCoachMarksView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
Expand All @@ -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)));
Expand Down