![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRAhM20sHRcj6V_bEm_wKxN7gjHreGjhyakXaMZdM3y_kC4H45SHFc3vWo0c1tN5Qf-iMgOXkVpUdbhZ_v9-rK4wWHILk6dFFcnV7ntt1XDgrHEwuQ0gekYjAmkSG7TBFbKd7C4VlB4G4/s200/Picture+1.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN54JtbYA0RS-vVW-_qfCRJBrW_1mz5J_Z_nReCUw7n_7yJDyfffdJIn9FerOvBNM0jouewXnl0Ir_Llwa6iMqZx3I0p5IfIZO7WcttS1DdOKq7nRaLJGMvY-NpacugOy4DI5t81EPYJw/s200/Picture+3.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiN-Vp-W2AqhNdn-oJacKVlWHhg6qeqpoepEDFCxT6IOfdw6aq7fhPRi4EchS07hoDaYInNDATPlmhTtUPFTSxjM5PTaPqnfkJrF2saIV-SOBYrvRVRwlft1cbFbZ2ZDY2qUfEfnVvWqsM/s200/Picture+7.png)
Drawing circle on UIView.
Circle.h
#import
@interface Circle : UIView {
}
@end
#import "Circle.h"
@implementation Circle
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)drawRect:(CGRect)rect {
CGRect leftOval = {10, 160, 70, 70};
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 0.5);
CGContextAddEllipseInRect(context, leftOval);
CGContextFillPath(context);
}
- (void)dealloc {
[super dealloc];
}
@end
Include these classes
#include "
#include "sys/sysctl.h"
Use this method for the Determine platform.
#pragma mark -
- (NSString *) platform
{
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
/*
Possible values:
"iPhone1,1" = iPhone 1G
"iPhone1,2" = iPhone 3G
"iPhone2,1" = iPhone 3GS
"iPod1,1" = iPod touch 1G
"iPod2,1" = iPod touch 2G
*/
NSString *platform = [NSString stringWithCString:machine];
free(machine);
return platform;
}