Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Ensure permanent pop-up labels are removed on draw
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali committed Jan 29, 2015
1 parent be78811 commit 1b547c0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
13 changes: 13 additions & 0 deletions Classes/BEMPermanentPopupView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// BEMPermanentPopupView.h
// SimpleLineGraph
//
// Created by Delisa Mason on 1/29/15.
// Copyright (c) 2015 Boris Emorine. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface BEMPermanentPopupView : UIView

@end
13 changes: 13 additions & 0 deletions Classes/BEMPermanentPopupView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// BEMPermanentPopupView.m
// SimpleLineGraph
//
// Created by Delisa Mason on 1/29/15.
// Copyright (c) 2015 Boris Emorine. All rights reserved.
//

#import "BEMPermanentPopupView.h"

@implementation BEMPermanentPopupView

@end
2 changes: 1 addition & 1 deletion Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#import "BEMCircle.h"
#import "BEMLine.h"

#import "BEMPermanentPopupView.h"

@protocol BEMSimpleLineGraphDelegate;
@protocol BEMSimpleLineGraphDataSource;
Expand Down
5 changes: 2 additions & 3 deletions Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ - (void)drawDots {

// Remove all dots that were previously on the graph
for (UIView *subview in [self subviews]) {
if ([subview isKindOfClass:[BEMCircle class]])
if ([subview isKindOfClass:[BEMCircle class]] || [subview isKindOfClass:[BEMPermanentPopupView class]])
[subview removeFromSuperview];
}

Expand Down Expand Up @@ -776,8 +776,7 @@ - (void)displayPermanentLabelForPoint:(BEMCircle *)circleDot {
[permanentPopUpLabel sizeToFit];
permanentPopUpLabel.center = CGPointMake(self.xCenterLabel, circleDot.center.y - circleDot.frame.size.height/2 - 15);
permanentPopUpLabel.alpha = 0;

UIView *permanentPopUpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, permanentPopUpLabel.frame.size.width + 7, permanentPopUpLabel.frame.size.height + 2)];
BEMPermanentPopupView *permanentPopUpView = [[BEMPermanentPopupView alloc] initWithFrame:CGRectMake(0, 0, permanentPopUpLabel.frame.size.width + 7, permanentPopUpLabel.frame.size.height + 2)];
permanentPopUpView.backgroundColor = [UIColor whiteColor];
permanentPopUpView.alpha = 0;
permanentPopUpView.layer.cornerRadius = 3;
Expand Down
6 changes: 6 additions & 0 deletions Sample Project/SimpleLineChart.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
8AB8D62F1A7ABDF600FC4AEC /* BEMPermanentPopupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8AB8D62E1A7ABDF600FC4AEC /* BEMPermanentPopupView.m */; };
99B15643187B412400B24591 /* StatsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 99B15642187B412400B24591 /* StatsViewController.m */; };
99B3FA3A1877898B00539A7B /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 99B3FA381877898B00539A7B /* LICENSE */; };
99B3FA3B1877898B00539A7B /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 99B3FA391877898B00539A7B /* README.md */; };
Expand Down Expand Up @@ -40,6 +41,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
8AB8D62D1A7ABDF600FC4AEC /* BEMPermanentPopupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BEMPermanentPopupView.h; sourceTree = "<group>"; };
8AB8D62E1A7ABDF600FC4AEC /* BEMPermanentPopupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BEMPermanentPopupView.m; sourceTree = "<group>"; };
99B15641187B412400B24591 /* StatsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatsViewController.h; sourceTree = "<group>"; };
99B15642187B412400B24591 /* StatsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatsViewController.m; sourceTree = "<group>"; };
99B3FA381877898B00539A7B /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
Expand Down Expand Up @@ -104,6 +107,8 @@
C3B90A59187D15F7003E407D /* BEMCircle.m */,
C3B90A5A187D15F7003E407D /* BEMLine.h */,
C3B90A5B187D15F7003E407D /* BEMLine.m */,
8AB8D62D1A7ABDF600FC4AEC /* BEMPermanentPopupView.h */,
8AB8D62E1A7ABDF600FC4AEC /* BEMPermanentPopupView.m */,
);
name = Classes;
path = ../Classes;
Expand Down Expand Up @@ -290,6 +295,7 @@
C3B90A5F187D15F7003E407D /* BEMCircle.m in Sources */,
C3FD816F186DFD9A00FD8ED3 /* ViewController.m in Sources */,
C3B90A60187D15F7003E407D /* BEMLine.m in Sources */,
8AB8D62F1A7ABDF600FC4AEC /* BEMPermanentPopupView.m in Sources */,
C3FD8169186DFD9A00FD8ED3 /* AppDelegate.m in Sources */,
99B15643187B412400B24591 /* StatsViewController.m in Sources */,
C3FD8165186DFD9A00FD8ED3 /* main.m in Sources */,
Expand Down

0 comments on commit 1b547c0

Please sign in to comment.