Skip to content

Commit

Permalink
Removed lblCaption
Browse files Browse the repository at this point in the history
  • Loading branch information
ddoria921 committed Apr 5, 2014
1 parent 984d69f commit f428ec6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
Binary file not shown.
1 change: 0 additions & 1 deletion Coach Marks/DDCoachMarksView.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

@property (nonatomic, weak) id<DDCoachMarksViewDelegate> delegate;
@property (nonatomic, retain) NSArray *coachMarks;
@property (nonatomic, weak) UILabel *lblCaption;
@property (nonatomic, retain) UIColor *maskColor;
@property (nonatomic) CGFloat animationDuration;
@property (nonatomic) CGFloat cutoutRadius;
Expand Down
21 changes: 0 additions & 21 deletions Coach Marks/DDCoachMarksView.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ - (void)goToCoachMarkIndexed:(NSUInteger)index {

// Coach mark definition
NSDictionary *markDef = [self.coachMarks objectAtIndex:index];
NSString *markCaption = [markDef objectForKey:@"caption"];
CGRect markRect = [[markDef objectForKey:@"rect"] CGRectValue];
NSString *shape = [markDef objectForKey:@"shape"];

Expand All @@ -191,26 +190,6 @@ - (void)goToCoachMarkIndexed:(NSUInteger)index {
[self animateNextBubble];
}

else {
// Calculate the caption position and size
self.lblCaption.alpha = 0.0f;
self.lblCaption.frame = (CGRect){{0.0f, 0.0f}, {self.maxLblWidth, 0.0f}};
self.lblCaption.text = markCaption;
[self.lblCaption sizeToFit];
CGFloat y = markRect.origin.y + markRect.size.height + self.lblSpacing;
CGFloat bottomY = y + self.lblCaption.frame.size.height + self.lblSpacing;
if (bottomY > self.bounds.size.height) {
y = markRect.origin.y - self.lblSpacing - self.lblCaption.frame.size.height;
}
CGFloat x = floorf((self.bounds.size.width - self.lblCaption.frame.size.width) / 2.0f);

// Animate the caption label
self.lblCaption.frame = (CGRect){{x, y}, self.lblCaption.frame.size};
[UIView animateWithDuration:0.3f animations:^{
self.lblCaption.alpha = 1.0f;
}];
}

// 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
14 changes: 4 additions & 10 deletions Coach Marks/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ - (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

NSArray *coachMarksDetails = @[
NSArray *coachMarks = @[
@{
@"rect": [NSValue valueWithCGRect:CGRectMake(6, 24, 40, 40)],
@"caption": @"Synchronize your mail",
Expand All @@ -43,16 +43,10 @@ - (void)viewDidAppear:(BOOL)animated
},
];

DDCoachMarksView *coachMarks = [[DDCoachMarksView alloc] initWithFrame:self.view.bounds coachMarks:coachMarksDetails];
DDCoachMarksView *coachMarksView = [[DDCoachMarksView alloc] initWithFrame:self.view.bounds coachMarks:coachMarks];

[self.view addSubview:coachMarks];
[coachMarks start];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[self.view addSubview:coachMarksView];
[coachMarksView start];
}

@end

0 comments on commit f428ec6

Please sign in to comment.