verwenden können ich diese Methode verwendet, die mir die geschlossenen Objekt gibt area.It kann hilfreich sein für Sie .
-(double)areaWithXpts :(NSArray *)xpts withYpts :(NSArray *)ypts totalPoints :(int)numPoints
{
double area=0;
int j=numPoints-1;
for(int i=0 ; i < numPoints;i++)
{
area=area+([[xpts objectAtIndex:j] floatValue]+[[xpts objectAtIndex:i] floatValue])*([[ypts objectAtIndex:j] floatValue]-[[ypts objectAtIndex:i] floatValue]);
j=i;
}
double areaVal=area/2;
NSLog(@"Area is :%f",areaVal);
return areaVal;
}
Usage:
Array von X Punkten
NSArray *xArray =[NSArray arrayWithObjects:@"0", @"10", @"10", @"29",nil];
Array von Y-Punkte
NSArray *yArray =[NSArray arrayWithObjects:@"4", @"26", @"26", @"4",nil];
Gesamtpunktzahl = Array zählen.
Hinweis: x Array und y Array haben beide dieselbe Anzahl.
double objectArea = [self areaWithXpts:xArray withYpts:yArray totalPoints:4];
Oder Sie können auch diese Antwort überprüfen - Area calculation in objective c
Und über Bereich mit Kurvenform-Objekt: Sie Referenz von diesem Link finden können - Curve shape object area reference
http://stackoverflow.com/questions/ 14220719/ios-how-to-calculate-Anzahl-von-Pixel-Bereich-eingeschlossen-durch-eine-Kurve –