├── .gitignore ├── Classes ├── MeterView.h ├── MeterView.m ├── MeterViewAppDelegate.h ├── MeterViewAppDelegate.m ├── MeterViewViewController.h └── MeterViewViewController.m ├── MainWindow.xib ├── MeterView-Info.plist ├── MeterView.png ├── MeterView.xcodeproj └── project.pbxproj ├── MeterViewViewController.xib ├── MeterView_Prefix.pch ├── README.markdown └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *~.nib 4 | 5 | build/ 6 | 7 | *.pbxuser 8 | *.perspective 9 | *.perspectivev3 10 | *.mode1v3 11 | -------------------------------------------------------------------------------- /Classes/MeterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MeterView.h 3 | // MeterTest 4 | // 5 | // Created by Frank Schmitt on 2010-12-04. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | #import 29 | 30 | @interface MeterNeedle : NSObject { 31 | UIColor *tintColor_; 32 | 33 | float length; 34 | float width; 35 | } 36 | 37 | @property (nonatomic, retain) UIColor *tintColor; 38 | @property (nonatomic, assign) float length; 39 | @property (nonatomic, assign) float width; 40 | 41 | - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx; 42 | 43 | @end 44 | 45 | @interface MeterView : UIView { 46 | float minNumber; 47 | float maxNumber; 48 | double startAngle; 49 | double arcLength; 50 | CGFloat lineWidth; 51 | float tickIncrement; 52 | float minorTickIncrement; 53 | 54 | float value; 55 | 56 | UILabel *textLabel; 57 | 58 | CALayer *needleLayer; 59 | UILabel *label; 60 | 61 | MeterNeedle *needle_; 62 | } 63 | 64 | @property (nonatomic, assign) float minNumber; 65 | @property (nonatomic, assign) float maxNumber; 66 | @property (nonatomic, assign) double startAngle; 67 | @property (nonatomic, assign) double arcLength; 68 | @property (nonatomic, assign) CGFloat lineWidth; 69 | @property (nonatomic, assign) float tickInset; 70 | @property (nonatomic, assign) float tickLength; 71 | @property (nonatomic, assign) float minorTickLength; 72 | 73 | @property (nonatomic, assign) float value; 74 | 75 | @property (nonatomic, readonly) UILabel *textLabel; 76 | @property (nonatomic, readonly) MeterNeedle *needle; 77 | 78 | -(void)initialize; 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /Classes/MeterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MeterView.m 3 | // MeterTest 4 | // 5 | // Created by Frank Schmitt on 2010-12-04. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "MeterView.h" 28 | #import 29 | 30 | @implementation MeterNeedle 31 | 32 | @synthesize length, width; 33 | @synthesize tintColor = tintColor_; 34 | 35 | - (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)ctx { 36 | CGContextSaveGState(ctx); 37 | 38 | CATransform3D transform = layer.transform; 39 | 40 | layer.transform = CATransform3DIdentity; 41 | 42 | CGContextSetFillColorWithColor(ctx, self.tintColor.CGColor); 43 | CGContextSetStrokeColorWithColor(ctx, self.tintColor.CGColor); 44 | CGContextSetLineWidth(ctx, self.width); 45 | 46 | CGFloat centerX = layer.frame.size.width / 2.0; 47 | CGFloat centerY = layer.frame.size.height / 2.0; 48 | 49 | CGFloat ellipseRadius = self.width * 2.0; 50 | 51 | CGContextFillEllipseInRect(ctx, CGRectMake(centerX - ellipseRadius, centerY - ellipseRadius, ellipseRadius * 2.0, ellipseRadius * 2.0)); 52 | 53 | CGFloat endX = (1 + self.length) * centerX; 54 | 55 | CGContextBeginPath(ctx); 56 | CGContextMoveToPoint(ctx, centerX, centerY); 57 | CGContextAddLineToPoint(ctx, endX, centerY); 58 | CGContextStrokePath(ctx); 59 | 60 | layer.transform = transform; 61 | 62 | CGContextRestoreGState(ctx); 63 | } 64 | 65 | - (void)dealloc { 66 | [tintColor_ release]; 67 | 68 | [super dealloc]; 69 | } 70 | @end 71 | 72 | @implementation MeterView 73 | 74 | @synthesize minNumber, maxNumber, startAngle, arcLength, lineWidth; 75 | @synthesize tickInset, tickLength, minorTickLength; 76 | @synthesize value; 77 | 78 | @synthesize textLabel = textLabel_; 79 | @synthesize needle = needle_; 80 | 81 | - (id)initWithFrame:(CGRect)frame { 82 | if (self = [super initWithFrame:frame]) { 83 | [self initialize]; 84 | } 85 | return self; 86 | } 87 | 88 | - (void)awakeFromNib { 89 | [self initialize]; 90 | } 91 | 92 | - (void)layoutSubviews { 93 | [super layoutSubviews]; 94 | 95 | int maxNumberOfTicks = (arcLength * self.frame.size.width) / (self.textLabel.font.pointSize * 10.0); 96 | 97 | float range = self.maxNumber - self.minNumber; 98 | 99 | float maxTickIncrement = range / maxNumberOfTicks; 100 | 101 | int power = 0; 102 | float temp = maxTickIncrement; 103 | 104 | while (temp >= 1.0) { 105 | temp = temp / 10.0; 106 | power ++; 107 | } 108 | 109 | float exponent = pow(10, power); 110 | if (temp < 0.2) { 111 | tickIncrement = 0.1 * exponent; 112 | minorTickIncrement = tickIncrement / 5.0; 113 | } else if (temp < 0.5) { 114 | tickIncrement = 0.2 * pow(10, power); 115 | minorTickIncrement = tickIncrement / 4.0; 116 | } else if (temp < 1.0) { 117 | tickIncrement = 0.5 * pow(10, power); 118 | minorTickIncrement = tickIncrement / 5.0; 119 | } else { 120 | tickIncrement = 1.0 * pow(10, power); 121 | minorTickIncrement = tickIncrement / 5.0; 122 | } 123 | } 124 | 125 | - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { 126 | CGFloat centerX = self.frame.size.width / 2.0; 127 | CGFloat centerY = self.frame.size.height / 2.0; 128 | CGFloat radius = fmin(self.frame.size.width, self.frame.size.height) / 2; 129 | 130 | int numberOfMinorTicks = (self.maxNumber - self.minNumber) / minorTickIncrement; 131 | 132 | CGPoint *points = (CGPoint*)malloc(sizeof(CGPoint) * numberOfMinorTicks * 2 + 2); 133 | 134 | CGContextSetFillColorWithColor(ctx, self.backgroundColor.CGColor); 135 | CGContextFillRect(ctx, layer.bounds); 136 | 137 | CGContextSetStrokeColorWithColor(ctx, self.textLabel.textColor.CGColor); 138 | CGContextSetFillColorWithColor(ctx, self.textLabel.textColor.CGColor); 139 | 140 | CGContextSetLineWidth(ctx, self.lineWidth); 141 | CGContextBeginPath(ctx); 142 | 143 | CGContextSetTextDrawingMode(ctx, kCGTextFill); 144 | CGContextSelectFont(ctx, [self.textLabel.font.fontName UTF8String], self.textLabel.font.pointSize, kCGEncodingMacRoman); 145 | CGAffineTransform transform = CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, 0.0); 146 | CGContextSetTextMatrix(ctx, transform); 147 | 148 | float minorTickAngleIncrement = self.arcLength / (float)numberOfMinorTicks; 149 | 150 | float textHeight = self.textLabel.font.lineHeight; 151 | float textInset = textHeight + tickLength; 152 | 153 | float angle = startAngle; 154 | int i = 0; 155 | for (float f = self.minNumber; f <= self.maxNumber; f += minorTickIncrement) { 156 | points[i++] = CGPointMake(centerX + cos(angle) * (radius - tickInset), centerY + sin(angle) * (radius - tickInset)); 157 | 158 | CGFloat myTickLength; 159 | 160 | if (fabs((f / tickIncrement - (int)(f / tickIncrement))) < 0.05) { // if is major tick 161 | myTickLength = self.tickLength; 162 | NSString *string = [[NSString alloc] initWithFormat:@"%1.0f", f]; 163 | 164 | float textWidth = textHeight * [string length] / 2; 165 | CGContextShowTextAtPoint(ctx, centerX + cos(angle) * (radius - textInset) - textWidth / 2.0, centerY + sin(angle) * (radius - textInset) + textHeight / 4.0, [string UTF8String], [string length]); 166 | [string release]; 167 | } else { 168 | myTickLength = self.minorTickLength; 169 | } 170 | 171 | points[i++] = CGPointMake(centerX + cos(angle) * (radius - myTickLength - tickInset), centerY + sin(angle) * (radius - myTickLength - tickInset)); 172 | 173 | angle += minorTickAngleIncrement; 174 | } 175 | 176 | CGContextStrokeLineSegments(ctx, points, numberOfMinorTicks * 2 + 2); 177 | free(points); 178 | 179 | CGContextBeginPath(ctx); 180 | float epsilon = lineWidth / (radius * M_PI * 2); 181 | CGContextAddArc(ctx, centerX, centerY, radius - self.tickInset, self.startAngle - epsilon, self.startAngle + self.arcLength + epsilon, NO); 182 | CGContextStrokePath(ctx); 183 | } 184 | 185 | - (void)drawRect:(CGRect)rect { 186 | } 187 | 188 | - (void)initialize { 189 | CGFloat span = fmin(self.frame.size.width, self.frame.size.height); 190 | 191 | self.minNumber = 0.0; 192 | self.maxNumber = 100.0; 193 | self.startAngle = M_PI; 194 | self.arcLength = 3.0 * M_PI / 2.0; 195 | self.lineWidth = span / 200.0; 196 | self.tickLength = span / 12.0; 197 | self.minorTickLength = span / 16.0; 198 | self.tickInset = self.lineWidth; 199 | 200 | textLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(0, 3.0 * self.frame.size.height / 10.0, self.frame.size.width, self.frame.size.height / 10.0)]; 201 | self.textLabel.textColor = [UIColor whiteColor]; 202 | self.textLabel.backgroundColor = [UIColor clearColor]; 203 | self.textLabel.textAlignment = UITextAlignmentCenter; 204 | self.textLabel.font = [UIFont systemFontOfSize:span / 17.77]; 205 | [self addSubview:self.textLabel]; 206 | 207 | needle_ = [[MeterNeedle alloc] init]; 208 | self.needle.tintColor = [UIColor orangeColor]; 209 | self.needle.width = 2.0; 210 | self.needle.length = 0.8; 211 | 212 | needleLayer = [[CALayer layer] retain]; 213 | needleLayer.bounds = self.bounds; 214 | needleLayer.position = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0); 215 | needleLayer.needsDisplayOnBoundsChange = YES; 216 | needleLayer.delegate = self.needle; 217 | 218 | [self.layer addSublayer:needleLayer]; 219 | 220 | [needleLayer setNeedsDisplay]; 221 | } 222 | 223 | - (void)setValue:(float)val { 224 | if (val > self.maxNumber) 225 | val = self.maxNumber; 226 | if (val < self.minNumber) 227 | val = self.minNumber; 228 | 229 | CGFloat angle = self.startAngle + arcLength * val / (self.maxNumber - self.minNumber) - arcLength * (self.minNumber / (self.maxNumber - self.minNumber)); 230 | 231 | needleLayer.transform = CATransform3DMakeRotation(angle, 0, 0, 1); 232 | } 233 | 234 | - (void)dealloc { 235 | [needle_ release]; 236 | [textLabel_ release]; 237 | 238 | [needleLayer release]; 239 | 240 | [super dealloc]; 241 | } 242 | 243 | @end 244 | 245 | -------------------------------------------------------------------------------- /Classes/MeterViewAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MeterViewAppDelegate.h 3 | // MeterView 4 | // 5 | // Created by Frank Schmitt on 2011-01-15. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @class MeterViewViewController; 30 | 31 | @interface MeterViewAppDelegate : NSObject { 32 | UIWindow *window; 33 | MeterViewViewController *viewController; 34 | } 35 | 36 | @property (nonatomic, retain) IBOutlet UIWindow *window; 37 | @property (nonatomic, retain) IBOutlet MeterViewViewController *viewController; 38 | 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /Classes/MeterViewAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // MeterViewAppDelegate.m 3 | // MeterView 4 | // 5 | // Created by Frank Schmitt on 2011-01-15. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "MeterViewAppDelegate.h" 28 | #import "MeterViewViewController.h" 29 | 30 | @implementation MeterViewAppDelegate 31 | 32 | @synthesize window; 33 | @synthesize viewController; 34 | 35 | 36 | #pragma mark - 37 | #pragma mark Application lifecycle 38 | 39 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 40 | 41 | // Override point for customization after application launch. 42 | 43 | // Add the view controller's view to the window and display. 44 | [self.window addSubview:viewController.view]; 45 | [self.window makeKeyAndVisible]; 46 | 47 | return YES; 48 | } 49 | 50 | #pragma mark - 51 | #pragma mark Memory management 52 | 53 | - (void)dealloc { 54 | [viewController release]; 55 | [window release]; 56 | [super dealloc]; 57 | } 58 | 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Classes/MeterViewViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MeterViewViewController.h 3 | // MeterView 4 | // 5 | // Created by Frank Schmitt on 2011-01-15. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @class MeterView; 30 | 31 | @interface MeterViewViewController : UIViewController { 32 | MeterView *speedometerView; 33 | MeterView *voltmeterView; 34 | } 35 | 36 | @property (nonatomic, retain) IBOutlet MeterView *speedometerView; 37 | @property (nonatomic, retain) IBOutlet MeterView *voltmeterView; 38 | 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /Classes/MeterViewViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MeterViewViewController.m 3 | // MeterView 4 | // 5 | // Created by Frank Schmitt on 2011-01-15. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "MeterViewViewController.h" 28 | #import "MeterView.h" 29 | 30 | @implementation MeterViewViewController 31 | 32 | @synthesize speedometerView, voltmeterView; 33 | 34 | - (void)viewDidLoad { 35 | [super viewDidLoad]; 36 | 37 | self.speedometerView.textLabel.text = @"km/h"; 38 | self.speedometerView.textLabel.font = [UIFont fontWithName:@"HelveticaNeue-BoldItalic" size:18.0]; 39 | self.speedometerView.lineWidth = 2.5; 40 | self.speedometerView.minorTickLength = 15.0; 41 | self.speedometerView.needle.width = 3.0; 42 | self.speedometerView.textLabel.textColor = [UIColor colorWithRed:0.7 green:1.0 blue:1.0 alpha:1.0]; 43 | 44 | self.speedometerView.value = 0.0; 45 | 46 | self.voltmeterView.startAngle = -3.0 * M_PI / 4.0; 47 | self.voltmeterView.arcLength = M_PI / 2.0; 48 | self.voltmeterView.value = 0.0; 49 | self.voltmeterView.textLabel.text = @"Volts"; 50 | self.voltmeterView.minNumber = 5.0; 51 | self.voltmeterView.maxNumber = 20.0; 52 | self.voltmeterView.textLabel.font = [UIFont fontWithName:@"Cochin-BoldItalic" size:15.0]; 53 | self.voltmeterView.textLabel.textColor = [UIColor blackColor]; 54 | self.voltmeterView.needle.tintColor = [UIColor brownColor]; 55 | self.voltmeterView.needle.width = 1.0; 56 | 57 | self.voltmeterView.value = 14.4; 58 | } 59 | 60 | - (void)viewDidUnload { 61 | self.speedometerView = nil; 62 | self.voltmeterView = nil; 63 | } 64 | 65 | - (void)dealloc { 66 | [speedometerView release]; 67 | [voltmeterView release]; 68 | 69 | [super dealloc]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1024 5 | 10D571 6 | 786 7 | 1038.29 8 | 460.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 112 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | IBCocoaTouchFramework 42 | 43 | 44 | MeterViewViewController 45 | 46 | 47 | 1 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 52 | 53 | 54 | 292 55 | {320, 480} 56 | 57 | 1 58 | MSAxIDEAA 59 | 60 | NO 61 | NO 62 | 63 | IBCocoaTouchFramework 64 | YES 65 | 66 | 67 | 68 | 69 | YES 70 | 71 | 72 | delegate 73 | 74 | 75 | 76 | 4 77 | 78 | 79 | 80 | viewController 81 | 82 | 83 | 84 | 11 85 | 86 | 87 | 88 | window 89 | 90 | 91 | 92 | 14 93 | 94 | 95 | 96 | 97 | YES 98 | 99 | 0 100 | 101 | 102 | 103 | 104 | 105 | -1 106 | 107 | 108 | File's Owner 109 | 110 | 111 | 3 112 | 113 | 114 | MeterView App Delegate 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 10 123 | 124 | 125 | 126 | 127 | 12 128 | 129 | 130 | 131 | 132 | 133 | 134 | YES 135 | 136 | YES 137 | -1.CustomClassName 138 | -2.CustomClassName 139 | 10.CustomClassName 140 | 10.IBEditorWindowLastContentRect 141 | 10.IBPluginDependency 142 | 12.IBEditorWindowLastContentRect 143 | 12.IBPluginDependency 144 | 3.CustomClassName 145 | 3.IBPluginDependency 146 | 147 | 148 | YES 149 | UIApplication 150 | UIResponder 151 | MeterViewViewController 152 | {{234, 376}, {320, 480}} 153 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 154 | {{525, 346}, {320, 480}} 155 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 156 | MeterViewAppDelegate 157 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 158 | 159 | 160 | 161 | YES 162 | 163 | 164 | YES 165 | 166 | 167 | 168 | 169 | YES 170 | 171 | 172 | YES 173 | 174 | 175 | 176 | 15 177 | 178 | 179 | 180 | YES 181 | 182 | UIWindow 183 | UIView 184 | 185 | IBUserSource 186 | 187 | 188 | 189 | 190 | MeterViewAppDelegate 191 | NSObject 192 | 193 | YES 194 | 195 | YES 196 | viewController 197 | window 198 | 199 | 200 | YES 201 | MeterViewViewController 202 | UIWindow 203 | 204 | 205 | 206 | YES 207 | 208 | YES 209 | viewController 210 | window 211 | 212 | 213 | YES 214 | 215 | viewController 216 | MeterViewViewController 217 | 218 | 219 | window 220 | UIWindow 221 | 222 | 223 | 224 | 225 | IBProjectSource 226 | Classes/MeterViewAppDelegate.h 227 | 228 | 229 | 230 | MeterViewAppDelegate 231 | NSObject 232 | 233 | IBUserSource 234 | 235 | 236 | 237 | 238 | MeterViewViewController 239 | UIViewController 240 | 241 | IBProjectSource 242 | Classes/MeterViewViewController.h 243 | 244 | 245 | 246 | 247 | YES 248 | 249 | NSObject 250 | 251 | IBFrameworkSource 252 | Foundation.framework/Headers/NSError.h 253 | 254 | 255 | 256 | NSObject 257 | 258 | IBFrameworkSource 259 | Foundation.framework/Headers/NSFileManager.h 260 | 261 | 262 | 263 | NSObject 264 | 265 | IBFrameworkSource 266 | Foundation.framework/Headers/NSKeyValueCoding.h 267 | 268 | 269 | 270 | NSObject 271 | 272 | IBFrameworkSource 273 | Foundation.framework/Headers/NSKeyValueObserving.h 274 | 275 | 276 | 277 | NSObject 278 | 279 | IBFrameworkSource 280 | Foundation.framework/Headers/NSKeyedArchiver.h 281 | 282 | 283 | 284 | NSObject 285 | 286 | IBFrameworkSource 287 | Foundation.framework/Headers/NSObject.h 288 | 289 | 290 | 291 | NSObject 292 | 293 | IBFrameworkSource 294 | Foundation.framework/Headers/NSRunLoop.h 295 | 296 | 297 | 298 | NSObject 299 | 300 | IBFrameworkSource 301 | Foundation.framework/Headers/NSThread.h 302 | 303 | 304 | 305 | NSObject 306 | 307 | IBFrameworkSource 308 | Foundation.framework/Headers/NSURL.h 309 | 310 | 311 | 312 | NSObject 313 | 314 | IBFrameworkSource 315 | Foundation.framework/Headers/NSURLConnection.h 316 | 317 | 318 | 319 | NSObject 320 | 321 | IBFrameworkSource 322 | UIKit.framework/Headers/UIAccessibility.h 323 | 324 | 325 | 326 | NSObject 327 | 328 | IBFrameworkSource 329 | UIKit.framework/Headers/UINibLoading.h 330 | 331 | 332 | 333 | NSObject 334 | 335 | IBFrameworkSource 336 | UIKit.framework/Headers/UIResponder.h 337 | 338 | 339 | 340 | UIApplication 341 | UIResponder 342 | 343 | IBFrameworkSource 344 | UIKit.framework/Headers/UIApplication.h 345 | 346 | 347 | 348 | UIResponder 349 | NSObject 350 | 351 | 352 | 353 | UISearchBar 354 | UIView 355 | 356 | IBFrameworkSource 357 | UIKit.framework/Headers/UISearchBar.h 358 | 359 | 360 | 361 | UISearchDisplayController 362 | NSObject 363 | 364 | IBFrameworkSource 365 | UIKit.framework/Headers/UISearchDisplayController.h 366 | 367 | 368 | 369 | UIView 370 | 371 | IBFrameworkSource 372 | UIKit.framework/Headers/UITextField.h 373 | 374 | 375 | 376 | UIView 377 | UIResponder 378 | 379 | IBFrameworkSource 380 | UIKit.framework/Headers/UIView.h 381 | 382 | 383 | 384 | UIViewController 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UINavigationController.h 388 | 389 | 390 | 391 | UIViewController 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPopoverController.h 395 | 396 | 397 | 398 | UIViewController 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UISplitViewController.h 402 | 403 | 404 | 405 | UIViewController 406 | 407 | IBFrameworkSource 408 | UIKit.framework/Headers/UITabBarController.h 409 | 410 | 411 | 412 | UIViewController 413 | UIResponder 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UIViewController.h 417 | 418 | 419 | 420 | UIWindow 421 | UIView 422 | 423 | IBFrameworkSource 424 | UIKit.framework/Headers/UIWindow.h 425 | 426 | 427 | 428 | 429 | 0 430 | IBCocoaTouchFramework 431 | 432 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 433 | 434 | 435 | 436 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 437 | 438 | 439 | YES 440 | MeterView.xcodeproj 441 | 3 442 | 112 443 | 444 | 445 | -------------------------------------------------------------------------------- /MeterView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | UIStatusBarStyle 30 | UIStatusBarStyleBlackOpaque 31 | 32 | 33 | -------------------------------------------------------------------------------- /MeterView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frankus/MeterView/ec1e9309f50239b4787c36893048843759339694/MeterView.png -------------------------------------------------------------------------------- /MeterView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 01079B7812E26BF30085216D /* MeterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 01079B7712E26BF30085216D /* MeterView.m */; }; 11 | 01079B8512E26C280085216D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01079B8412E26C280085216D /* QuartzCore.framework */; }; 12 | 1D3623260D0F684500981E51 /* MeterViewAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MeterViewAppDelegate.m */; }; 13 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 14 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 15 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 16 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 17 | 2899E5220DE3E06400AC0155 /* MeterViewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* MeterViewViewController.xib */; }; 18 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 19 | 28D7ACF80DDB3853001CB0EB /* MeterViewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* MeterViewViewController.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXFileReference section */ 23 | 01079B7612E26BF30085216D /* MeterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeterView.h; sourceTree = ""; }; 24 | 01079B7712E26BF30085216D /* MeterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeterView.m; sourceTree = ""; }; 25 | 01079B8412E26C280085216D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 26 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 27 | 1D3623240D0F684500981E51 /* MeterViewAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeterViewAppDelegate.h; sourceTree = ""; }; 28 | 1D3623250D0F684500981E51 /* MeterViewAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeterViewAppDelegate.m; sourceTree = ""; }; 29 | 1D6058910D05DD3D006BFB54 /* MeterView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeterView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 31 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32 | 2899E5210DE3E06400AC0155 /* MeterViewViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MeterViewViewController.xib; sourceTree = ""; }; 33 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 34 | 28D7ACF60DDB3853001CB0EB /* MeterViewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeterViewViewController.h; sourceTree = ""; }; 35 | 28D7ACF70DDB3853001CB0EB /* MeterViewViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeterViewViewController.m; sourceTree = ""; }; 36 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 32CA4F630368D1EE00C91783 /* MeterView_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeterView_Prefix.pch; sourceTree = ""; }; 38 | 8D1107310486CEB800E47090 /* MeterView-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MeterView-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 47 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 48 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 49 | 01079B8512E26C280085216D /* QuartzCore.framework in Frameworks */, 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | 080E96DDFE201D6D7F000001 /* Classes */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 1D3623240D0F684500981E51 /* MeterViewAppDelegate.h */, 60 | 1D3623250D0F684500981E51 /* MeterViewAppDelegate.m */, 61 | 28D7ACF60DDB3853001CB0EB /* MeterViewViewController.h */, 62 | 28D7ACF70DDB3853001CB0EB /* MeterViewViewController.m */, 63 | 01079B7612E26BF30085216D /* MeterView.h */, 64 | 01079B7712E26BF30085216D /* MeterView.m */, 65 | ); 66 | path = Classes; 67 | sourceTree = ""; 68 | }; 69 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 1D6058910D05DD3D006BFB54 /* MeterView.app */, 73 | ); 74 | name = Products; 75 | sourceTree = ""; 76 | }; 77 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 080E96DDFE201D6D7F000001 /* Classes */, 81 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 82 | 29B97317FDCFA39411CA2CEA /* Resources */, 83 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 84 | 19C28FACFE9D520D11CA2CBB /* Products */, 85 | ); 86 | name = CustomTemplate; 87 | sourceTree = ""; 88 | }; 89 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 32CA4F630368D1EE00C91783 /* MeterView_Prefix.pch */, 93 | 29B97316FDCFA39411CA2CEA /* main.m */, 94 | ); 95 | name = "Other Sources"; 96 | sourceTree = ""; 97 | }; 98 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 2899E5210DE3E06400AC0155 /* MeterViewViewController.xib */, 102 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 103 | 8D1107310486CEB800E47090 /* MeterView-Info.plist */, 104 | ); 105 | name = Resources; 106 | sourceTree = ""; 107 | }; 108 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 112 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 113 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 114 | 01079B8412E26C280085216D /* QuartzCore.framework */, 115 | ); 116 | name = Frameworks; 117 | sourceTree = ""; 118 | }; 119 | /* End PBXGroup section */ 120 | 121 | /* Begin PBXNativeTarget section */ 122 | 1D6058900D05DD3D006BFB54 /* MeterView */ = { 123 | isa = PBXNativeTarget; 124 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MeterView" */; 125 | buildPhases = ( 126 | 1D60588D0D05DD3D006BFB54 /* Resources */, 127 | 1D60588E0D05DD3D006BFB54 /* Sources */, 128 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = MeterView; 135 | productName = MeterView; 136 | productReference = 1D6058910D05DD3D006BFB54 /* MeterView.app */; 137 | productType = "com.apple.product-type.application"; 138 | }; 139 | /* End PBXNativeTarget section */ 140 | 141 | /* Begin PBXProject section */ 142 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 143 | isa = PBXProject; 144 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MeterView" */; 145 | compatibilityVersion = "Xcode 3.1"; 146 | developmentRegion = English; 147 | hasScannedForEncodings = 1; 148 | knownRegions = ( 149 | English, 150 | Japanese, 151 | French, 152 | German, 153 | ); 154 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | 1D6058900D05DD3D006BFB54 /* MeterView */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 169 | 2899E5220DE3E06400AC0155 /* MeterViewViewController.xib in Resources */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXResourcesBuildPhase section */ 174 | 175 | /* Begin PBXSourcesBuildPhase section */ 176 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 177 | isa = PBXSourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 181 | 1D3623260D0F684500981E51 /* MeterViewAppDelegate.m in Sources */, 182 | 28D7ACF80DDB3853001CB0EB /* MeterViewViewController.m in Sources */, 183 | 01079B7812E26BF30085216D /* MeterView.m in Sources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXSourcesBuildPhase section */ 188 | 189 | /* Begin XCBuildConfiguration section */ 190 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 191 | isa = XCBuildConfiguration; 192 | buildSettings = { 193 | ALWAYS_SEARCH_USER_PATHS = NO; 194 | COPY_PHASE_STRIP = NO; 195 | GCC_DYNAMIC_NO_PIC = NO; 196 | GCC_OPTIMIZATION_LEVEL = 0; 197 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 198 | GCC_PREFIX_HEADER = MeterView_Prefix.pch; 199 | INFOPLIST_FILE = "MeterView-Info.plist"; 200 | PRODUCT_NAME = MeterView; 201 | }; 202 | name = Debug; 203 | }; 204 | 1D6058950D05DD3E006BFB54 /* Release */ = { 205 | isa = XCBuildConfiguration; 206 | buildSettings = { 207 | ALWAYS_SEARCH_USER_PATHS = NO; 208 | COPY_PHASE_STRIP = YES; 209 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 210 | GCC_PREFIX_HEADER = MeterView_Prefix.pch; 211 | INFOPLIST_FILE = "MeterView-Info.plist"; 212 | PRODUCT_NAME = MeterView; 213 | VALIDATE_PRODUCT = YES; 214 | }; 215 | name = Release; 216 | }; 217 | C01FCF4F08A954540054247B /* Debug */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 221 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 222 | GCC_C_LANGUAGE_STANDARD = c99; 223 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 224 | GCC_WARN_UNUSED_VARIABLE = YES; 225 | PREBINDING = NO; 226 | SDKROOT = iphoneos; 227 | }; 228 | name = Debug; 229 | }; 230 | C01FCF5008A954540054247B /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 234 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 235 | GCC_C_LANGUAGE_STANDARD = c99; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 237 | GCC_WARN_UNUSED_VARIABLE = YES; 238 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 239 | PREBINDING = NO; 240 | SDKROOT = iphoneos; 241 | }; 242 | name = Release; 243 | }; 244 | /* End XCBuildConfiguration section */ 245 | 246 | /* Begin XCConfigurationList section */ 247 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "MeterView" */ = { 248 | isa = XCConfigurationList; 249 | buildConfigurations = ( 250 | 1D6058940D05DD3E006BFB54 /* Debug */, 251 | 1D6058950D05DD3E006BFB54 /* Release */, 252 | ); 253 | defaultConfigurationIsVisible = 0; 254 | defaultConfigurationName = Release; 255 | }; 256 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MeterView" */ = { 257 | isa = XCConfigurationList; 258 | buildConfigurations = ( 259 | C01FCF4F08A954540054247B /* Debug */, 260 | C01FCF5008A954540054247B /* Release */, 261 | ); 262 | defaultConfigurationIsVisible = 0; 263 | defaultConfigurationName = Release; 264 | }; 265 | /* End XCConfigurationList section */ 266 | }; 267 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 268 | } 269 | -------------------------------------------------------------------------------- /MeterViewViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1056 5 | 10J567 6 | 823 7 | 1038.35 8 | 462.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 132 12 | 13 | 14 | YES 15 | 16 | 17 | 18 | YES 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | YES 23 | 24 | YES 25 | 26 | 27 | YES 28 | 29 | 30 | 31 | YES 32 | 33 | IBFilesOwner 34 | IBCocoaTouchFramework 35 | 36 | 37 | IBFirstResponder 38 | IBCocoaTouchFramework 39 | 40 | 41 | 42 | 274 43 | 44 | YES 45 | 46 | 47 | 274 48 | {{35, 320}, {250, 250}} 49 | 50 | 51 | 3 52 | MCAwAA 53 | 54 | NO 55 | 56 | IBCocoaTouchFramework 57 | 58 | 59 | 60 | 274 61 | {320, 320} 62 | 63 | 64 | 3 65 | MC4xNDk2MzUwMzY1AA 66 | 67 | NO 68 | 69 | IBCocoaTouchFramework 70 | 71 | 72 | {320, 460} 73 | 74 | 75 | 3 76 | MQA 77 | 78 | 2 79 | 80 | 81 | IBCocoaTouchFramework 82 | 83 | 84 | 85 | 86 | YES 87 | 88 | 89 | speedometerView 90 | 91 | 92 | 93 | 8 94 | 95 | 96 | 97 | view 98 | 99 | 100 | 101 | 10 102 | 103 | 104 | 105 | voltmeterView 106 | 107 | 108 | 109 | 13 110 | 111 | 112 | 113 | 114 | YES 115 | 116 | 0 117 | 118 | 119 | 120 | 121 | 122 | -1 123 | 124 | 125 | File's Owner 126 | 127 | 128 | -2 129 | 130 | 131 | 132 | 133 | 9 134 | 135 | 136 | YES 137 | 138 | 139 | 140 | 141 | 142 | 143 | 6 144 | 145 | 146 | YES 147 | 148 | 149 | 150 | 151 | 12 152 | 153 | 154 | 155 | 156 | 157 | 158 | YES 159 | 160 | YES 161 | -1.CustomClassName 162 | -2.CustomClassName 163 | 12.CustomClassName 164 | 12.IBEditorWindowLastContentRect 165 | 12.IBPluginDependency 166 | 12.IBViewBoundsToFrameTransform 167 | 6.CustomClassName 168 | 6.IBEditorWindowLastContentRect 169 | 6.IBPluginDependency 170 | 6.IBViewBoundsToFrameTransform 171 | 9.IBEditorWindowLastContentRect 172 | 9.IBPluginDependency 173 | 174 | 175 | YES 176 | MeterViewViewController 177 | UIResponder 178 | MeterView 179 | {{239, 276}, {320, 480}} 180 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 181 | 182 | P4AAAL+AAABCcAAAxA4AAA 183 | 184 | MeterView 185 | {{239, 276}, {320, 480}} 186 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 187 | 188 | {{14, 274}, {320, 460}} 189 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 190 | 191 | 192 | 193 | YES 194 | 195 | 196 | YES 197 | 198 | 199 | 200 | 201 | YES 202 | 203 | 204 | YES 205 | 206 | 207 | 208 | 13 209 | 210 | 211 | 212 | YES 213 | 214 | MeterView 215 | UIView 216 | 217 | IBProjectSource 218 | Classes/MeterView.h 219 | 220 | 221 | 222 | MeterViewViewController 223 | UIViewController 224 | 225 | YES 226 | 227 | YES 228 | speedometerView 229 | voltmeterView 230 | 231 | 232 | YES 233 | MeterView 234 | MeterView 235 | 236 | 237 | 238 | YES 239 | 240 | YES 241 | speedometerView 242 | voltmeterView 243 | 244 | 245 | YES 246 | 247 | speedometerView 248 | MeterView 249 | 250 | 251 | voltmeterView 252 | MeterView 253 | 254 | 255 | 256 | 257 | IBProjectSource 258 | Classes/MeterViewViewController.h 259 | 260 | 261 | 262 | 263 | YES 264 | 265 | NSObject 266 | 267 | IBFrameworkSource 268 | Foundation.framework/Headers/NSError.h 269 | 270 | 271 | 272 | NSObject 273 | 274 | IBFrameworkSource 275 | Foundation.framework/Headers/NSFileManager.h 276 | 277 | 278 | 279 | NSObject 280 | 281 | IBFrameworkSource 282 | Foundation.framework/Headers/NSKeyValueCoding.h 283 | 284 | 285 | 286 | NSObject 287 | 288 | IBFrameworkSource 289 | Foundation.framework/Headers/NSKeyValueObserving.h 290 | 291 | 292 | 293 | NSObject 294 | 295 | IBFrameworkSource 296 | Foundation.framework/Headers/NSKeyedArchiver.h 297 | 298 | 299 | 300 | NSObject 301 | 302 | IBFrameworkSource 303 | Foundation.framework/Headers/NSObject.h 304 | 305 | 306 | 307 | NSObject 308 | 309 | IBFrameworkSource 310 | Foundation.framework/Headers/NSRunLoop.h 311 | 312 | 313 | 314 | NSObject 315 | 316 | IBFrameworkSource 317 | Foundation.framework/Headers/NSThread.h 318 | 319 | 320 | 321 | NSObject 322 | 323 | IBFrameworkSource 324 | Foundation.framework/Headers/NSURL.h 325 | 326 | 327 | 328 | NSObject 329 | 330 | IBFrameworkSource 331 | Foundation.framework/Headers/NSURLConnection.h 332 | 333 | 334 | 335 | NSObject 336 | 337 | IBFrameworkSource 338 | QuartzCore.framework/Headers/CAAnimation.h 339 | 340 | 341 | 342 | NSObject 343 | 344 | IBFrameworkSource 345 | QuartzCore.framework/Headers/CALayer.h 346 | 347 | 348 | 349 | NSObject 350 | 351 | IBFrameworkSource 352 | UIKit.framework/Headers/UIAccessibility.h 353 | 354 | 355 | 356 | NSObject 357 | 358 | IBFrameworkSource 359 | UIKit.framework/Headers/UINibLoading.h 360 | 361 | 362 | 363 | NSObject 364 | 365 | IBFrameworkSource 366 | UIKit.framework/Headers/UIResponder.h 367 | 368 | 369 | 370 | UIResponder 371 | NSObject 372 | 373 | 374 | 375 | UISearchBar 376 | UIView 377 | 378 | IBFrameworkSource 379 | UIKit.framework/Headers/UISearchBar.h 380 | 381 | 382 | 383 | UISearchDisplayController 384 | NSObject 385 | 386 | IBFrameworkSource 387 | UIKit.framework/Headers/UISearchDisplayController.h 388 | 389 | 390 | 391 | UIView 392 | 393 | IBFrameworkSource 394 | UIKit.framework/Headers/UIPrintFormatter.h 395 | 396 | 397 | 398 | UIView 399 | 400 | IBFrameworkSource 401 | UIKit.framework/Headers/UITextField.h 402 | 403 | 404 | 405 | UIView 406 | UIResponder 407 | 408 | IBFrameworkSource 409 | UIKit.framework/Headers/UIView.h 410 | 411 | 412 | 413 | UIViewController 414 | 415 | IBFrameworkSource 416 | UIKit.framework/Headers/UINavigationController.h 417 | 418 | 419 | 420 | UIViewController 421 | 422 | IBFrameworkSource 423 | UIKit.framework/Headers/UIPopoverController.h 424 | 425 | 426 | 427 | UIViewController 428 | 429 | IBFrameworkSource 430 | UIKit.framework/Headers/UISplitViewController.h 431 | 432 | 433 | 434 | UIViewController 435 | 436 | IBFrameworkSource 437 | UIKit.framework/Headers/UITabBarController.h 438 | 439 | 440 | 441 | UIViewController 442 | UIResponder 443 | 444 | IBFrameworkSource 445 | UIKit.framework/Headers/UIViewController.h 446 | 447 | 448 | 449 | 450 | 0 451 | IBCocoaTouchFramework 452 | 453 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 454 | 455 | 456 | 457 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 458 | 459 | 460 | YES 461 | MeterView.xcodeproj 462 | 3 463 | 132 464 | 465 | 466 | -------------------------------------------------------------------------------- /MeterView_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'MeterView' target in the 'MeterView' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | This project contains a view class that I put together to draw dashboard-style gauges in iOS. 2 | 3 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MeterView 4 | // 5 | // Created by Frank Schmitt on 2011-01-15. 6 | // Copyright © 2011 Laika Systems 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | int main(int argc, char *argv[]) { 30 | 31 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 32 | int retVal = UIApplicationMain(argc, argv, nil, nil); 33 | [pool release]; 34 | return retVal; 35 | } 36 | --------------------------------------------------------------------------------