iphone - How To Declare an MKPolygon -
ey guys, seemingly simple problem apparently complicated me. trying create 1 instance of mkpolygon , ain't going well. here code:
mkmappoint point1 = {38.53607,-121.765793}; mkmappoint point2 = {38.537606,-121.768379}; mkmappoint point3 = {38.53487,-121.770578}; nsarray *mappointarr = [[nsarray alloc] initwithobjects:point1,point2,point3,nil count:3]; //errors here mkpolygon *polygon = [mkpolygon polygonwithpoints:mappointarr count:3]; i getting bunch of errors on line @ initialize array(incompatible type argument 1...). idea what's wrong? in advance!
mkmappoint plain c-structure , can't add objective-c container directly.
in case not need +polygonwithpoints: requires not nsarray, c-array 1st parameter. proper way create polygon be:
mkmappoint points[3] = {{38.53607,-121.765793}, {38.537606,-121.768379}, {38.53487,-121.770578}}; mkpolygon *polygon = [mkpolygon polygonwithpoints:points count:3];
Comments
Post a Comment