ios6 - Manage memory allocation issue on Map iOS -
ios6 - Manage memory allocation issue on Map iOS -
in iphone app have map view. in displaying number of pin views depends on info web server. here method used it.
- (mkannotationview *)mapview:(mkmapview *)mapview viewforannotation:(id <mkannotation>)annotation { nsstring *identifier = @"mypin"; self.pinview = (mkpinannotationview *)[self.mapview dequeuereusableannotationviewwithidentifier:identifier]; if (self.pinview == nil) { self.pinview= [[[mkpinannotationview alloc] initwithannotation:annotation reuseidentifier:identifier]autorelease]; //11.1% } else { self.pinview.annotation = annotation; } uibutton* rightbutton = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; //20.4% [rightbutton settitle:annotation.title forstate:uicontrolstatenormal]; self.pinview.rightcalloutaccessoryview = rightbutton; //2.7% myannotation *annot = (myannotation*)annotation; uiimageview *egoimageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"defaultperson"]]; //17.5% nsstring *imageurl = [nsstring stringwithformat:@"%@%@", commonimageurl, [friendsprofileimagearray objectatindex:annot.tag]]; //9.4% if ([[uiscreen mainscreen] respondstoselector:@selector(displaylinkwithtarget:selector:)] && ([uiscreen mainscreen].scale == 2.0)) { // retina display [egoimageview setimagewithurl:[nsurl urlwithstring:imageurl] placeholderimage:[uiimage imagenamed:@"defaultperson@2x.png"]]; //2.6% egoimageview.image = [uiimage imagewithcgimage:egoimageview.image.cgimage scale:egoimageview.image.size.width/25 orientation:egoimageview.image.imageorientation]; } else { // non-retina display [egoimageview setimagewithurl:[nsurl urlwithstring:imageurl] placeholderimage:[uiimage imagenamed:@"defaultperson.png"]]; //14.6% egoimageview.image = [uiimage imagewithcgimage:egoimageview.image.cgimage scale:egoimageview.image.size.width/25 orientation:egoimageview.image.imageorientation]; //1.6% } [egoimageview sizetofit]; self.pinview.leftcalloutaccessoryview = egoimageview; //3.1% [egoimageview release]; self.pinview.canshowcallout=yes; self.pinview.animatesdrop=yes; //pin color based on status..... if ([annot.relationshipstatus intvalue]==2 ) self.pinview.pincolor=mkpinannotationcolorgreen; else self.pinview.pincolor=mkpinannotationcolorpurple; //17.1% homecoming self.pinview; }
in have mentioned percentage of memory allocations. if continuously load map, total memory usage increases , app crashes. how can prepare this? have tried prepare it, don't know more can do.
please help, in advance.
memory-management ios6 annotations mkmapview
Comments
Post a Comment