├── LICENSE
├── README.md
├── WCSBubbleView
├── WCSBubble.h
├── WCSBubble.m
├── WCSBubbleView.h
└── WCSBubbleView.m
├── WCSBubbleViewExample.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ └── Aaron.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── WCSBubbleViewExample.xcscheme
│ └── xcschememanagement.plist
├── WCSBubbleViewExample
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── ViewController.h
├── ViewController.m
└── main.m
└── screens
└── screen-1.png
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | WCSBubbleView
2 | ===========
3 |
4 | 3-tier Bubble view with title, detail, value and some options.
5 |
6 |
7 |
8 | Delegate
9 | ------------
10 |
11 | Use the delegate callbacks to receive information about the bubble that the user selected.
12 |
13 | ```objc
14 | - (void)didSelectBubbleView:(WCSBubble *)bubble;
15 | ```
16 |
17 | @WrightsCS
18 | ------------
19 |
20 | Twitter: @WrightsCS
21 | http://www.wrightscsapps.com
22 |
23 |
24 | Apps using WCSBubbleView
25 | ------------
26 |
27 | If you are using this in your app, please let me know and I will add your app here!
28 |
--------------------------------------------------------------------------------
/WCSBubbleView/WCSBubble.h:
--------------------------------------------------------------------------------
1 | //
2 | // WCSBubble.h
3 | // WCSBubbleView
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import
13 |
14 | #define kLabelFont(S) [UIFont fontWithName:@"HelveticaNeue-Light" size:S]
15 |
16 | @interface WCSBubble : UIView
17 | @property (nonatomic, assign) BOOL isActive;
18 | @property (nonatomic, assign) CGFloat bubbleAlpha;
19 | @property (nonatomic, strong) UIColor * bubbleColor;
20 | @property (nonatomic, strong) UIColor * textColor;
21 | @property (nonatomic, strong) NSString * title;
22 | @property (nonatomic, strong) NSString * detail;
23 | @property (nonatomic, strong) NSString * value;
24 | @end
25 |
--------------------------------------------------------------------------------
/WCSBubbleView/WCSBubble.m:
--------------------------------------------------------------------------------
1 | //
2 | // WCSBubble.m
3 | // WCSBubbleView
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import "WCSBubble.h"
13 |
14 | @interface WCSBubble ()
15 | @property (nonatomic, strong) UILabel * valueLabel, * titleLabel, * detailLabel;
16 | @end
17 |
18 | @implementation WCSBubble
19 |
20 | - (instancetype)initWithFrame:(CGRect)frame
21 | {
22 | self = [super initWithFrame:frame];
23 | if ( self )
24 | {
25 | self.layer.cornerRadius = (frame.size.width/2);
26 |
27 | _valueLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, frame.size.height/2-15, frame.size.width, 30.0f)];
28 | _valueLabel.textColor = _textColor;
29 | _valueLabel.font = kLabelFont(30);
30 | _valueLabel.textAlignment = NSTextAlignmentCenter;
31 | _valueLabel.adjustsFontSizeToFitWidth = YES;
32 | [self addSubview:_valueLabel];
33 |
34 | _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_valueLabel.frame.origin.x, _valueLabel.frame.origin.y-15, _valueLabel.frame.size.width, 20.0f)];
35 | _titleLabel.textColor = _textColor;
36 | _titleLabel.font = kLabelFont(15);
37 | _titleLabel.textAlignment = NSTextAlignmentCenter;
38 | _titleLabel.adjustsFontSizeToFitWidth = YES;
39 | [self addSubview:_titleLabel];
40 |
41 | _detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(_valueLabel.frame.origin.x, _valueLabel.frame.origin.y+25, _valueLabel.frame.size.width, 20.0f)];
42 | _detailLabel.textColor = _textColor;
43 | _detailLabel.font = kLabelFont(10);
44 | _detailLabel.textAlignment = NSTextAlignmentCenter;
45 | _detailLabel.adjustsFontSizeToFitWidth = YES;
46 | [self addSubview:_detailLabel];
47 | }
48 | return self;
49 | }
50 |
51 | - (void)setBubbleAlpha:(CGFloat)bubbleAlpha {
52 | CGFloat h,s,b,a; [self.backgroundColor getHue:&h saturation:&s brightness:&b alpha:&a];
53 | self.backgroundColor = [UIColor colorWithHue:h saturation:s brightness:b alpha:bubbleAlpha];
54 | }
55 |
56 | - (void)setBubbleColor:(UIColor *)bubbleColor {
57 | self.backgroundColor = bubbleColor;
58 | }
59 |
60 | - (void)setTextColor:(UIColor *)textColor {
61 | _textColor = textColor;
62 | _titleLabel.textColor = textColor;
63 | _detailLabel.textColor = textColor;
64 | _valueLabel.textColor = textColor;
65 | }
66 |
67 | - (void)setTitle:(NSString *)title {
68 | _title = title;
69 | _titleLabel.text = title;
70 | }
71 | - (void)setDetail:(NSString *)detail {
72 | _detail = detail;
73 | _detailLabel.text = detail;
74 | }
75 | - (void)setValue:(NSString *)value {
76 | _value = value;
77 | _valueLabel.text = value;
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/WCSBubbleView/WCSBubbleView.h:
--------------------------------------------------------------------------------
1 | //
2 | // WCSBubbleView.h
3 | // WCSBubbleView
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import
13 | #import "WCSBubble.h"
14 |
15 | @class WCSBubble;
16 |
17 | @protocol WCSBubbleViewDelegate
18 | @optional
19 | - (void)didSelectBubbleView:(WCSBubble*)bubble;
20 | @end
21 |
22 | @interface WCSBubbleView : UIView
23 | @property (nonatomic, weak) id delegate;
24 | @property (nonatomic, setter=setShowOverview:) BOOL showOverview;
25 | @property (nonatomic, assign) CGFloat low, medium, high;
26 | @property (nonatomic, strong) UIColor * lowColor, * mediumColor, * highColor, * textColor;
27 | @property (nonatomic, strong) NSString * lowTitle, * lowDetail, * lowValue;
28 | @property (nonatomic, strong) NSString * mediumTitle, * mediumDetail, * mediumValue;
29 | @property (nonatomic, strong) NSString * highTitle, * highDetail, * highValue;
30 | - (void)reloadBubbles;
31 | @end
32 |
--------------------------------------------------------------------------------
/WCSBubbleView/WCSBubbleView.m:
--------------------------------------------------------------------------------
1 | //
2 | // WCSBubbleView.m
3 | // WCSBubbleView
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import "WCSBubble.h"
13 | #import "WCSBubbleView.h"
14 |
15 | float LOW_PERCENTAGE = 30;
16 | float MED_PERCENTAGE = 20;
17 | float HGH_PERCENTAGE = 50;
18 |
19 | @interface WCSBubbleView ()
20 | @property (nonatomic, strong) WCSBubble * bubbleLow, * bubbleMedium, * bubbleHigh;
21 | @property (nonatomic, strong) UILabel * labelOverview;
22 | @property (nonatomic, assign) CGFloat max, min, screenWidth, screenHeight;
23 | @property (nonatomic, assign) UIColor * colorHigh, * colorMedium, * colorLow;
24 | @end
25 |
26 | @implementation WCSBubbleView
27 |
28 | - (instancetype)initWithFrame:(CGRect)frame
29 | {
30 | self = [super initWithFrame:frame];
31 | if ( self ) {
32 | [self setupView];
33 | }
34 | return self;
35 | }
36 |
37 | - (void)awakeFromNib {
38 | [self setupView];
39 | }
40 |
41 | #pragma mark - Setup Views
42 |
43 | - (void)setupView
44 | {
45 | _screenWidth = self.frame.size.width;
46 | _screenHeight = self.frame.size.height;
47 |
48 | _min = 100;
49 | _max = _screenWidth/2;
50 |
51 | //self.backgroundColor = [UIColor clearColor];
52 |
53 | UITapGestureRecognizer* resetTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resetActiveBubbles:)];
54 | resetTap.numberOfTapsRequired = 1;
55 | resetTap.numberOfTouchesRequired = 1;
56 | [self addGestureRecognizer:resetTap];
57 | }
58 |
59 | - (void)setShowOverview:(BOOL)showOverview
60 | {
61 | _showOverview = showOverview;
62 | if ( showOverview ) {
63 | _labelOverview = [[UILabel alloc] initWithFrame:CGRectMake(0, self.frame.size.height-40, self.frame.size.width, 40)];
64 | _labelOverview.font = kLabelFont(32);
65 | _labelOverview.backgroundColor = [UIColor clearColor];
66 | _labelOverview.textAlignment = NSTextAlignmentCenter;
67 | _labelOverview.adjustsFontSizeToFitWidth = YES;
68 | _labelOverview.minimumScaleFactor = .5f;
69 | _labelOverview.numberOfLines = 3;
70 | _labelOverview.text = @"Select a bubble.";
71 | [self addSubview:_labelOverview];
72 | }
73 | else
74 | [_labelOverview removeFromSuperview];
75 | }
76 |
77 | - (void)reloadBubbles
78 | {
79 | BOOL _createBubble = YES;
80 |
81 | if ( _createBubble )
82 | {
83 | _low = ( isnan(_low) ? 0 : _low );
84 |
85 | if ( _bubbleLow ) [_bubbleLow removeFromSuperview];
86 |
87 | float radius = ( (_max - _min) * (_low/100) + _min ) / 2;
88 | CGFloat x = (_screenWidth/2) - radius;
89 | CGFloat y = x;
90 |
91 | _bubbleLow = [[WCSBubble alloc] initWithFrame:CGRectMake(x, y, radius*2, radius*2)];
92 | _bubbleLow.tag = 101;
93 | _bubbleLow.bubbleColor = _lowColor;
94 | _bubbleLow.textColor = _textColor;
95 | _bubbleLow.title = _lowTitle;
96 | _bubbleLow.detail = _lowDetail;
97 | _bubbleLow.value = _lowValue;
98 | [self addSubview:_bubbleLow];
99 |
100 | [self addTapGestureToView:_bubbleLow];
101 | }
102 | if ( _createBubble )
103 | {
104 | _medium = ( isnan(_medium) ? 0 : _medium );
105 |
106 | if ( _bubbleMedium ) [_bubbleMedium removeFromSuperview];
107 |
108 | float radius = ( (_max - _min) * (_medium/100) + _min) / 2;
109 | CGFloat x = ((_screenWidth/2) - radius) - (radius - (radius/4));
110 | CGFloat y = ((_screenWidth/2) - radius) - radius;
111 |
112 | _bubbleMedium = [[WCSBubble alloc] initWithFrame:CGRectMake(x, y, radius*2, radius*2)];
113 | _bubbleMedium.tag = 102;
114 | _bubbleMedium.bubbleColor = _mediumColor;
115 | _bubbleMedium.textColor = _textColor;
116 | _bubbleMedium.title = _mediumTitle;
117 | _bubbleMedium.detail = _mediumDetail;
118 | _bubbleMedium.value = _mediumValue;
119 | [self addSubview:_bubbleMedium];
120 |
121 | [self addTapGestureToView:_bubbleMedium];
122 | }
123 | if ( _createBubble )
124 | {
125 | _high = ( isnan(_high) ? 0 : _high );
126 |
127 | if ( _bubbleHigh ) [_bubbleHigh removeFromSuperview];
128 |
129 | float radius = ( (_max - _min) * (_high/100) + _min ) / 2;
130 | CGFloat x = ((_screenWidth/2) - radius) + (radius - (radius/4));
131 | CGFloat y = ((_screenWidth/2) - radius) - radius;
132 |
133 | _bubbleHigh = [[WCSBubble alloc] initWithFrame:CGRectMake(x, y, radius*2, radius*2)];
134 | _bubbleHigh.tag = 103;
135 | _bubbleHigh.bubbleColor = _highColor;
136 | _bubbleHigh.textColor = _textColor;
137 | _bubbleHigh.title = _highTitle;
138 | _bubbleHigh.detail = _highDetail;
139 | _bubbleHigh.value = _highValue;
140 | [self addSubview:_bubbleHigh];
141 |
142 | [self addTapGestureToView:_bubbleHigh];
143 | }
144 |
145 | [self arrangeBubbles];
146 | }
147 |
148 | - (void)arrangeBubbles
149 | {
150 | if ( (_low > _medium && _low > _high) || _bubbleLow.isActive )
151 | {
152 | _bubbleLow.bubbleAlpha = 1;
153 | _bubbleMedium.bubbleAlpha = .5;
154 | _bubbleHigh.bubbleAlpha = .5;
155 |
156 | if ( _bubbleLow.isActive )
157 | [self bringSubviewToFront:_bubbleLow];
158 | else
159 | [self sendSubviewToBack:_bubbleLow];
160 | }
161 |
162 | else if ( (_medium > _low && _medium > _high) || _bubbleMedium.isActive )
163 | {
164 | _bubbleLow.bubbleAlpha = .5;
165 | _bubbleMedium.bubbleAlpha = 1;
166 | _bubbleHigh.bubbleAlpha = .5;
167 |
168 | if ( _bubbleMedium.isActive )
169 | [self bringSubviewToFront:_bubbleMedium];
170 | else
171 | [self sendSubviewToBack:_bubbleMedium];
172 | }
173 |
174 | else if ( (_high > _low && _high > _medium) || _bubbleHigh.isActive )
175 | {
176 | _bubbleLow.bubbleAlpha = .5;
177 | _bubbleMedium.bubbleAlpha = .5;
178 | _bubbleHigh.bubbleAlpha = 1;
179 |
180 | if ( _bubbleHigh.isActive )
181 | [self bringSubviewToFront:_bubbleHigh];
182 | else
183 | [self sendSubviewToBack:_bubbleHigh];
184 | }
185 | }
186 |
187 | #pragma mark - Private Methods
188 |
189 | - (void)addTapGestureToView:(UIView*)view
190 | {
191 | UITapGestureRecognizer* singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(bringBubbleToFront:)];
192 | singleTap.numberOfTapsRequired = 1;
193 | singleTap.numberOfTouchesRequired = 1;
194 | [view addGestureRecognizer:singleTap];
195 | }
196 |
197 | - (void)bringBubbleToFront:(UITapGestureRecognizer*)recognizer
198 | {
199 | WCSBubble * bubbleView = (WCSBubble*)recognizer.view;
200 | if ( [bubbleView isEqual:_bubbleLow] ) {
201 | _bubbleLow.isActive = YES;
202 | _bubbleMedium.isActive = NO;
203 | _bubbleHigh.isActive = NO;
204 | bubbleView = _bubbleLow;
205 | }
206 | if ( [bubbleView isEqual:_bubbleMedium] ) {
207 | _bubbleLow.isActive = NO;
208 | _bubbleMedium.isActive = YES;
209 | _bubbleHigh.isActive = NO;
210 | bubbleView = _bubbleMedium;
211 | }
212 | if ( [bubbleView isEqual:_bubbleHigh] ) {
213 | _bubbleLow.isActive = NO;
214 | _bubbleMedium.isActive = NO;
215 | _bubbleHigh.isActive = YES;
216 | bubbleView = _bubbleHigh;
217 | }
218 |
219 | NSLog(@"selected bubble: %@", bubbleView.title);
220 |
221 | if ( _showOverview ) {
222 | _labelOverview.text = [NSString stringWithFormat:@"Selected %@ Bubble", bubbleView.title];
223 | }
224 |
225 | if ( [self.delegate respondsToSelector:@selector(didSelectBubbleView:)] )
226 | [self.delegate didSelectBubbleView:bubbleView];
227 |
228 | [self arrangeBubbles];
229 | }
230 |
231 | - (void)resetActiveBubbles:(UITapGestureRecognizer*)recognizer
232 | {
233 | _bubbleLow.isActive = NO;
234 | _bubbleMedium.isActive = NO;
235 | _bubbleHigh.isActive = NO;
236 |
237 | if ( _showOverview ) {
238 | _labelOverview.text = nil;
239 | }
240 |
241 | [self arrangeBubbles];
242 | }
243 |
244 | @end
245 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 931BAEA61BCC5D0F00265FE1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 931BAEA51BCC5D0F00265FE1 /* main.m */; };
11 | 931BAEA91BCC5D0F00265FE1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 931BAEA81BCC5D0F00265FE1 /* AppDelegate.m */; };
12 | 931BAEAC1BCC5D0F00265FE1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 931BAEAB1BCC5D0F00265FE1 /* ViewController.m */; };
13 | 931BAEAF1BCC5D0F00265FE1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 931BAEAD1BCC5D0F00265FE1 /* Main.storyboard */; };
14 | 931BAEB11BCC5D0F00265FE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 931BAEB01BCC5D0F00265FE1 /* Assets.xcassets */; };
15 | 931BAEB41BCC5D0F00265FE1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 931BAEB21BCC5D0F00265FE1 /* LaunchScreen.storyboard */; };
16 | 931BAEBE1BCC5D4400265FE1 /* WCSBubbleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 931BAEBD1BCC5D4400265FE1 /* WCSBubbleView.m */; };
17 | 931BAEC21BCC5ED900265FE1 /* WCSBubble.m in Sources */ = {isa = PBXBuildFile; fileRef = 931BAEC11BCC5ED900265FE1 /* WCSBubble.m */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXFileReference section */
21 | 931BAEA11BCC5D0F00265FE1 /* WCSBubbleViewExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WCSBubbleViewExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
22 | 931BAEA51BCC5D0F00265FE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
23 | 931BAEA71BCC5D0F00265FE1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = WCSBubbleViewExample/AppDelegate.h; sourceTree = ""; };
24 | 931BAEA81BCC5D0F00265FE1 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = WCSBubbleViewExample/AppDelegate.m; sourceTree = ""; };
25 | 931BAEAA1BCC5D0F00265FE1 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
26 | 931BAEAB1BCC5D0F00265FE1 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
27 | 931BAEAE1BCC5D0F00265FE1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
28 | 931BAEB01BCC5D0F00265FE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
29 | 931BAEB31BCC5D0F00265FE1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
30 | 931BAEB51BCC5D0F00265FE1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = WCSBubbleViewExample/Info.plist; sourceTree = ""; };
31 | 931BAEBC1BCC5D4400265FE1 /* WCSBubbleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WCSBubbleView.h; sourceTree = ""; };
32 | 931BAEBD1BCC5D4400265FE1 /* WCSBubbleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WCSBubbleView.m; sourceTree = ""; };
33 | 931BAEC01BCC5ED900265FE1 /* WCSBubble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WCSBubble.h; sourceTree = ""; };
34 | 931BAEC11BCC5ED900265FE1 /* WCSBubble.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WCSBubble.m; sourceTree = ""; };
35 | /* End PBXFileReference section */
36 |
37 | /* Begin PBXFrameworksBuildPhase section */
38 | 931BAE9E1BCC5D0F00265FE1 /* Frameworks */ = {
39 | isa = PBXFrameworksBuildPhase;
40 | buildActionMask = 2147483647;
41 | files = (
42 | );
43 | runOnlyForDeploymentPostprocessing = 0;
44 | };
45 | /* End PBXFrameworksBuildPhase section */
46 |
47 | /* Begin PBXGroup section */
48 | 931BAE981BCC5D0E00265FE1 = {
49 | isa = PBXGroup;
50 | children = (
51 | 931BAEB51BCC5D0F00265FE1 /* Info.plist */,
52 | 931BAEA71BCC5D0F00265FE1 /* AppDelegate.h */,
53 | 931BAEA81BCC5D0F00265FE1 /* AppDelegate.m */,
54 | 931BAEAD1BCC5D0F00265FE1 /* Main.storyboard */,
55 | 931BAEB21BCC5D0F00265FE1 /* LaunchScreen.storyboard */,
56 | 931BAEBB1BCC5D3400265FE1 /* WCSBubbleView */,
57 | 931BAEA31BCC5D0F00265FE1 /* WCSBubbleViewExample */,
58 | 931BAEA21BCC5D0F00265FE1 /* Products */,
59 | );
60 | sourceTree = "";
61 | };
62 | 931BAEA21BCC5D0F00265FE1 /* Products */ = {
63 | isa = PBXGroup;
64 | children = (
65 | 931BAEA11BCC5D0F00265FE1 /* WCSBubbleViewExample.app */,
66 | );
67 | name = Products;
68 | sourceTree = "";
69 | };
70 | 931BAEA31BCC5D0F00265FE1 /* WCSBubbleViewExample */ = {
71 | isa = PBXGroup;
72 | children = (
73 | 931BAEAA1BCC5D0F00265FE1 /* ViewController.h */,
74 | 931BAEAB1BCC5D0F00265FE1 /* ViewController.m */,
75 | 931BAEB01BCC5D0F00265FE1 /* Assets.xcassets */,
76 | 931BAEA41BCC5D0F00265FE1 /* Supporting Files */,
77 | );
78 | path = WCSBubbleViewExample;
79 | sourceTree = "";
80 | };
81 | 931BAEA41BCC5D0F00265FE1 /* Supporting Files */ = {
82 | isa = PBXGroup;
83 | children = (
84 | 931BAEA51BCC5D0F00265FE1 /* main.m */,
85 | );
86 | name = "Supporting Files";
87 | sourceTree = "";
88 | };
89 | 931BAEBB1BCC5D3400265FE1 /* WCSBubbleView */ = {
90 | isa = PBXGroup;
91 | children = (
92 | 931BAEC01BCC5ED900265FE1 /* WCSBubble.h */,
93 | 931BAEC11BCC5ED900265FE1 /* WCSBubble.m */,
94 | 931BAEBC1BCC5D4400265FE1 /* WCSBubbleView.h */,
95 | 931BAEBD1BCC5D4400265FE1 /* WCSBubbleView.m */,
96 | );
97 | path = WCSBubbleView;
98 | sourceTree = "";
99 | };
100 | /* End PBXGroup section */
101 |
102 | /* Begin PBXNativeTarget section */
103 | 931BAEA01BCC5D0F00265FE1 /* WCSBubbleViewExample */ = {
104 | isa = PBXNativeTarget;
105 | buildConfigurationList = 931BAEB81BCC5D0F00265FE1 /* Build configuration list for PBXNativeTarget "WCSBubbleViewExample" */;
106 | buildPhases = (
107 | 931BAE9D1BCC5D0F00265FE1 /* Sources */,
108 | 931BAE9E1BCC5D0F00265FE1 /* Frameworks */,
109 | 931BAE9F1BCC5D0F00265FE1 /* Resources */,
110 | );
111 | buildRules = (
112 | );
113 | dependencies = (
114 | );
115 | name = WCSBubbleViewExample;
116 | productName = WCSBubbleViewExample;
117 | productReference = 931BAEA11BCC5D0F00265FE1 /* WCSBubbleViewExample.app */;
118 | productType = "com.apple.product-type.application";
119 | };
120 | /* End PBXNativeTarget section */
121 |
122 | /* Begin PBXProject section */
123 | 931BAE991BCC5D0E00265FE1 /* Project object */ = {
124 | isa = PBXProject;
125 | attributes = {
126 | LastUpgradeCheck = 0810;
127 | ORGANIZATIONNAME = "Wrights Creative Services, L.L.C.";
128 | TargetAttributes = {
129 | 931BAEA01BCC5D0F00265FE1 = {
130 | CreatedOnToolsVersion = 7.0;
131 | DevelopmentTeam = 474YUX6494;
132 | };
133 | };
134 | };
135 | buildConfigurationList = 931BAE9C1BCC5D0E00265FE1 /* Build configuration list for PBXProject "WCSBubbleViewExample" */;
136 | compatibilityVersion = "Xcode 3.2";
137 | developmentRegion = English;
138 | hasScannedForEncodings = 0;
139 | knownRegions = (
140 | en,
141 | Base,
142 | );
143 | mainGroup = 931BAE981BCC5D0E00265FE1;
144 | productRefGroup = 931BAEA21BCC5D0F00265FE1 /* Products */;
145 | projectDirPath = "";
146 | projectRoot = "";
147 | targets = (
148 | 931BAEA01BCC5D0F00265FE1 /* WCSBubbleViewExample */,
149 | );
150 | };
151 | /* End PBXProject section */
152 |
153 | /* Begin PBXResourcesBuildPhase section */
154 | 931BAE9F1BCC5D0F00265FE1 /* Resources */ = {
155 | isa = PBXResourcesBuildPhase;
156 | buildActionMask = 2147483647;
157 | files = (
158 | 931BAEB41BCC5D0F00265FE1 /* LaunchScreen.storyboard in Resources */,
159 | 931BAEB11BCC5D0F00265FE1 /* Assets.xcassets in Resources */,
160 | 931BAEAF1BCC5D0F00265FE1 /* Main.storyboard in Resources */,
161 | );
162 | runOnlyForDeploymentPostprocessing = 0;
163 | };
164 | /* End PBXResourcesBuildPhase section */
165 |
166 | /* Begin PBXSourcesBuildPhase section */
167 | 931BAE9D1BCC5D0F00265FE1 /* Sources */ = {
168 | isa = PBXSourcesBuildPhase;
169 | buildActionMask = 2147483647;
170 | files = (
171 | 931BAEAC1BCC5D0F00265FE1 /* ViewController.m in Sources */,
172 | 931BAEA91BCC5D0F00265FE1 /* AppDelegate.m in Sources */,
173 | 931BAEBE1BCC5D4400265FE1 /* WCSBubbleView.m in Sources */,
174 | 931BAEC21BCC5ED900265FE1 /* WCSBubble.m in Sources */,
175 | 931BAEA61BCC5D0F00265FE1 /* main.m in Sources */,
176 | );
177 | runOnlyForDeploymentPostprocessing = 0;
178 | };
179 | /* End PBXSourcesBuildPhase section */
180 |
181 | /* Begin PBXVariantGroup section */
182 | 931BAEAD1BCC5D0F00265FE1 /* Main.storyboard */ = {
183 | isa = PBXVariantGroup;
184 | children = (
185 | 931BAEAE1BCC5D0F00265FE1 /* Base */,
186 | );
187 | name = Main.storyboard;
188 | path = WCSBubbleViewExample;
189 | sourceTree = "";
190 | };
191 | 931BAEB21BCC5D0F00265FE1 /* LaunchScreen.storyboard */ = {
192 | isa = PBXVariantGroup;
193 | children = (
194 | 931BAEB31BCC5D0F00265FE1 /* Base */,
195 | );
196 | name = LaunchScreen.storyboard;
197 | path = WCSBubbleViewExample;
198 | sourceTree = "";
199 | };
200 | /* End PBXVariantGroup section */
201 |
202 | /* Begin XCBuildConfiguration section */
203 | 931BAEB61BCC5D0F00265FE1 /* Debug */ = {
204 | isa = XCBuildConfiguration;
205 | buildSettings = {
206 | ALWAYS_SEARCH_USER_PATHS = NO;
207 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
208 | CLANG_CXX_LIBRARY = "libc++";
209 | CLANG_ENABLE_MODULES = YES;
210 | CLANG_ENABLE_OBJC_ARC = YES;
211 | CLANG_WARN_BOOL_CONVERSION = YES;
212 | CLANG_WARN_CONSTANT_CONVERSION = YES;
213 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
214 | CLANG_WARN_EMPTY_BODY = YES;
215 | CLANG_WARN_ENUM_CONVERSION = YES;
216 | CLANG_WARN_INFINITE_RECURSION = YES;
217 | CLANG_WARN_INT_CONVERSION = YES;
218 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
219 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
220 | CLANG_WARN_UNREACHABLE_CODE = YES;
221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
222 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
223 | COPY_PHASE_STRIP = NO;
224 | DEBUG_INFORMATION_FORMAT = dwarf;
225 | ENABLE_STRICT_OBJC_MSGSEND = YES;
226 | ENABLE_TESTABILITY = YES;
227 | GCC_C_LANGUAGE_STANDARD = gnu99;
228 | GCC_DYNAMIC_NO_PIC = NO;
229 | GCC_NO_COMMON_BLOCKS = YES;
230 | GCC_OPTIMIZATION_LEVEL = 0;
231 | GCC_PREPROCESSOR_DEFINITIONS = (
232 | "DEBUG=1",
233 | "$(inherited)",
234 | );
235 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
236 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
237 | GCC_WARN_UNDECLARED_SELECTOR = YES;
238 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
239 | GCC_WARN_UNUSED_FUNCTION = YES;
240 | GCC_WARN_UNUSED_VARIABLE = YES;
241 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
242 | MTL_ENABLE_DEBUG_INFO = YES;
243 | ONLY_ACTIVE_ARCH = YES;
244 | SDKROOT = iphoneos;
245 | TARGETED_DEVICE_FAMILY = "1,2";
246 | };
247 | name = Debug;
248 | };
249 | 931BAEB71BCC5D0F00265FE1 /* Release */ = {
250 | isa = XCBuildConfiguration;
251 | buildSettings = {
252 | ALWAYS_SEARCH_USER_PATHS = NO;
253 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
254 | CLANG_CXX_LIBRARY = "libc++";
255 | CLANG_ENABLE_MODULES = YES;
256 | CLANG_ENABLE_OBJC_ARC = YES;
257 | CLANG_WARN_BOOL_CONVERSION = YES;
258 | CLANG_WARN_CONSTANT_CONVERSION = YES;
259 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
260 | CLANG_WARN_EMPTY_BODY = YES;
261 | CLANG_WARN_ENUM_CONVERSION = YES;
262 | CLANG_WARN_INFINITE_RECURSION = YES;
263 | CLANG_WARN_INT_CONVERSION = YES;
264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
265 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
266 | CLANG_WARN_UNREACHABLE_CODE = YES;
267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
268 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
269 | COPY_PHASE_STRIP = NO;
270 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
271 | ENABLE_NS_ASSERTIONS = NO;
272 | ENABLE_STRICT_OBJC_MSGSEND = YES;
273 | GCC_C_LANGUAGE_STANDARD = gnu99;
274 | GCC_NO_COMMON_BLOCKS = YES;
275 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
276 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
277 | GCC_WARN_UNDECLARED_SELECTOR = YES;
278 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
279 | GCC_WARN_UNUSED_FUNCTION = YES;
280 | GCC_WARN_UNUSED_VARIABLE = YES;
281 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
282 | MTL_ENABLE_DEBUG_INFO = NO;
283 | SDKROOT = iphoneos;
284 | TARGETED_DEVICE_FAMILY = "1,2";
285 | VALIDATE_PRODUCT = YES;
286 | };
287 | name = Release;
288 | };
289 | 931BAEB91BCC5D0F00265FE1 /* Debug */ = {
290 | isa = XCBuildConfiguration;
291 | buildSettings = {
292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
293 | DEVELOPMENT_TEAM = 474YUX6494;
294 | INFOPLIST_FILE = WCSBubbleViewExample/Info.plist;
295 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
296 | PRODUCT_BUNDLE_IDENTIFIER = com.wrightscs.WCSBubbleViewExample;
297 | PRODUCT_NAME = "$(TARGET_NAME)";
298 | };
299 | name = Debug;
300 | };
301 | 931BAEBA1BCC5D0F00265FE1 /* Release */ = {
302 | isa = XCBuildConfiguration;
303 | buildSettings = {
304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
305 | DEVELOPMENT_TEAM = 474YUX6494;
306 | INFOPLIST_FILE = WCSBubbleViewExample/Info.plist;
307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
308 | PRODUCT_BUNDLE_IDENTIFIER = com.wrightscs.WCSBubbleViewExample;
309 | PRODUCT_NAME = "$(TARGET_NAME)";
310 | };
311 | name = Release;
312 | };
313 | /* End XCBuildConfiguration section */
314 |
315 | /* Begin XCConfigurationList section */
316 | 931BAE9C1BCC5D0E00265FE1 /* Build configuration list for PBXProject "WCSBubbleViewExample" */ = {
317 | isa = XCConfigurationList;
318 | buildConfigurations = (
319 | 931BAEB61BCC5D0F00265FE1 /* Debug */,
320 | 931BAEB71BCC5D0F00265FE1 /* Release */,
321 | );
322 | defaultConfigurationIsVisible = 0;
323 | defaultConfigurationName = Release;
324 | };
325 | 931BAEB81BCC5D0F00265FE1 /* Build configuration list for PBXNativeTarget "WCSBubbleViewExample" */ = {
326 | isa = XCConfigurationList;
327 | buildConfigurations = (
328 | 931BAEB91BCC5D0F00265FE1 /* Debug */,
329 | 931BAEBA1BCC5D0F00265FE1 /* Release */,
330 | );
331 | defaultConfigurationIsVisible = 0;
332 | defaultConfigurationName = Release;
333 | };
334 | /* End XCConfigurationList section */
335 | };
336 | rootObject = 931BAE991BCC5D0E00265FE1 /* Project object */;
337 | }
338 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample.xcodeproj/xcuserdata/Aaron.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample.xcodeproj/xcuserdata/Aaron.xcuserdatad/xcschemes/WCSBubbleViewExample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample.xcodeproj/xcuserdata/Aaron.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | WCSBubbleViewExample.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 931BAEA01BCC5D0F00265FE1
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // WCSBubbleViewExample
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import
13 |
14 | @interface AppDelegate : UIResponder
15 |
16 | @property (strong, nonatomic) UIWindow *window;
17 |
18 |
19 | @end
20 |
21 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // WCSBubbleViewExample
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import "AppDelegate.h"
13 |
14 | @interface AppDelegate ()
15 |
16 | @end
17 |
18 | @implementation AppDelegate
19 |
20 |
21 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
22 | // Override point for customization after application launch.
23 | return YES;
24 | }
25 |
26 | - (void)applicationWillResignActive:(UIApplication *)application {
27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
29 | }
30 |
31 | - (void)applicationDidEnterBackground:(UIApplication *)application {
32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
34 | }
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 | - (void)applicationDidBecomeActive:(UIApplication *)application {
41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
42 | }
43 |
44 | - (void)applicationWillTerminate:(UIApplication *)application {
45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
46 | }
47 |
48 | @end
49 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/WCSBubbleViewExample/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
24 |
33 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // WCSBubbleViewExample
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import
13 |
14 | @interface ViewController : UIViewController
15 |
16 |
17 | @end
18 |
19 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // WCSBubbleViewExample
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import "ViewController.h"
13 | #import "WCSBubbleView.h"
14 |
15 | @interface ViewController ()
16 | @property (nonatomic, strong) IBOutlet WCSBubbleView * bubbleView;
17 | @end
18 |
19 | @implementation ViewController
20 |
21 | - (void)viewDidLoad
22 | {
23 | [super viewDidLoad];
24 |
25 | //UIColor * bgColor = [UIColor colorWithRed:234/255.f green:234/255.f blue:234/255.f alpha:1.0];
26 | //UIColor * lowColor = [UIColor colorWithRed:62/255.f green:133/255.f blue:240/255.f alpha:1.0];
27 | //UIColor * medColor = [UIColor colorWithRed:213/255.f green:97/255.f blue:78/255.f alpha:1.0];
28 | //UIColor * hghColor = [UIColor colorWithRed:55/255.f green:172/255.f blue:75/255.f alpha:1.0];
29 |
30 | //_bubbleView = [[WCSBubbleView alloc] initWithFrame:CGRectMake(0, 0, 300, 300)];
31 | //_bubbleView.center = self.view.center;
32 | //_bubbleView.backgroundColor = bgColor;
33 | //[self.view addSubview:_bubbleView];
34 |
35 | _bubbleView.showOverview = YES;
36 | _bubbleView.textColor = [UIColor whiteColor];
37 | // Low Value
38 | _bubbleView.low = [self randomValue];
39 | _bubbleView.lowTitle = @"LOW";
40 | _bubbleView.lowDetail = @"Low Detail";
41 | _bubbleView.lowValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.low];
42 | _bubbleView.lowColor = [self randomColor];
43 | // Medium Value
44 | _bubbleView.medium = [self randomValue];
45 | _bubbleView.mediumTitle = @"MEDIUM";
46 | _bubbleView.mediumDetail = @"Medium Detail";
47 | _bubbleView.mediumValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.medium];
48 | _bubbleView.mediumColor = [self randomColor];
49 | // High Value
50 | _bubbleView.high = [self randomValue];
51 | _bubbleView.highTitle = @"HIGH";
52 | _bubbleView.highDetail = @"High Detail";
53 | _bubbleView.highValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.high];
54 | _bubbleView.highColor = [self randomColor];
55 | // Reload Bubbles
56 | [_bubbleView reloadBubbles];
57 | }
58 |
59 | - (void)didReceiveMemoryWarning {
60 | [super didReceiveMemoryWarning];
61 | // Dispose of any resources that can be recreated.
62 | }
63 |
64 | #pragma mark - Private Methods
65 |
66 | - (UIColor*)randomColor {
67 | CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0
68 | CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white
69 | CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black
70 | return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
71 | }
72 |
73 | - (float)randomValue {
74 | return arc4random_uniform(100);
75 | }
76 |
77 | - (NSString*)randomTitle {
78 | NSArray * titles = @[ @"ONE", @"TWO", @"THREE", @"FOUR", @"FIVE" ];
79 | return titles[arc4random_uniform((uint32_t)titles.count)];
80 | }
81 |
82 | - (NSString*)randomDetail {
83 | NSArray * details = @[ @"ONE Detail", @"TWO Detail", @"THREE Detail", @"FOUR Detail", @"FIVE Detail" ];
84 | return details[arc4random_uniform((uint32_t)details.count)];
85 | }
86 |
87 | #pragma mark IBActions
88 |
89 | - (IBAction)generateRandomColors:(id)sender {
90 | _bubbleView.lowColor = [self randomColor];
91 | _bubbleView.mediumColor = [self randomColor];
92 | _bubbleView.highColor = [self randomColor];
93 | [_bubbleView reloadBubbles];
94 | }
95 |
96 | - (IBAction)generateRandomValues:(id)sender {
97 | _bubbleView.low = [self randomValue];
98 | _bubbleView.lowValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.low];
99 |
100 | _bubbleView.medium = [self randomValue];
101 | _bubbleView.mediumValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.medium];
102 |
103 | _bubbleView.high = [self randomValue];
104 | _bubbleView.highValue = [NSString stringWithFormat:@"%.f%%", _bubbleView.high];
105 |
106 | [_bubbleView reloadBubbles];
107 | }
108 |
109 | - (IBAction)generateRandomTitles:(id)sender {
110 | _bubbleView.lowTitle = [self randomTitle];
111 | _bubbleView.mediumTitle = [self randomTitle];
112 | _bubbleView.highTitle = [self randomTitle];
113 | [_bubbleView reloadBubbles];
114 | }
115 |
116 | - (IBAction)generateRandomDetails:(id)sender {
117 | _bubbleView.lowDetail = [self randomDetail];
118 | _bubbleView.mediumDetail = [self randomDetail];
119 | _bubbleView.highDetail = [self randomDetail];
120 | [_bubbleView reloadBubbles];
121 | }
122 |
123 | #pragma mark - WCSBubbleViewDelegate
124 |
125 | - (void)didSelectBubbleView:(WCSBubble *)bubble {
126 | NSLog(@"User Selected Bubble: %@", bubble.title);
127 | }
128 |
129 | @end
130 |
--------------------------------------------------------------------------------
/WCSBubbleViewExample/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // WCSBubbleViewExample
4 | //
5 | // Created by Aaron C. Wright on 10/12/15.
6 | // Copyright © 2015 Wrights Creative Services, L.L.C. All rights reserved.
7 | //
8 | // aaron@Wrightscs.com
9 | // http://www.wrightscs.com | http://www.wrightscsapps.com
10 | //
11 |
12 | #import
13 | #import "AppDelegate.h"
14 |
15 | int main(int argc, char * argv[]) {
16 | @autoreleasepool {
17 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/screens/screen-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WrightsCS/WCSBubbleView/95ff780e6fcc1b0f6db5a00a078167ea455c4197/screens/screen-1.png
--------------------------------------------------------------------------------