diff --git a/.gitignore b/.gitignore index e43b0f9..496ee2c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -.DS_Store +.DS_Store \ No newline at end of file diff --git a/UIView+WSCoachMarks.h b/UIView+WSCoachMarks.h new file mode 100644 index 0000000..46d5ec8 --- /dev/null +++ b/UIView+WSCoachMarks.h @@ -0,0 +1,31 @@ +// +// UIView+WSCoachMarksAdditions.h +// +// +// Created by Fawkes Wei on 4/18/13. +// Copyright (c) 2013 Gogolook. All rights reserved. +// + +#import + +/* + ## Usage Example + + NSArray *coachMarks = @[ + @{ + @"rect": [NSValue valueWithCGRect:[button rectToMarkInView:self.view]], + @"caption": @"This is some awesome button!" + } + ]; + + WSCoachMarksView *coachMarksView = [[WSCoachMarksView alloc] initWithFrame:self.view.frame coachMarks:coachMarks]; + [self.view addSubview:coachMarksView]; + [coachMarksView start]; + */ + +@interface UIView (WSCoachMarks) + +- (CGRect)rectToMarkInView:(UIView *)view; +- (CGRect)rectToMarkInView:(UIView *)view withInset:(UIEdgeInsets )inset; + +@end diff --git a/UIView+WSCoachMarks.m b/UIView+WSCoachMarks.m new file mode 100644 index 0000000..5ef72e7 --- /dev/null +++ b/UIView+WSCoachMarks.m @@ -0,0 +1,21 @@ +// +// UIView+WSCoachMarksAdditions.m +// +// +// Created by Fawkes Wei on 4/18/13. +// Copyright (c) 2013 Gogolook. All rights reserved. +// + +#import "UIView+WSCoachMarks.h" + +@implementation UIView (WSCoachMarks) + +- (CGRect)rectToMarkInView:(UIView *)view { + return [self rectToMarkInView:view withInset:UIEdgeInsetsZero]; +} + +- (CGRect)rectToMarkInView:(UIView *)view withInset:(UIEdgeInsets )inset { + return UIEdgeInsetsInsetRect([self convertRect:self.bounds toView:view], inset); +} + +@end