2012-02-17 8 views
0

拡張現実感プロジェクトを作成していて、画像にズームエフェクトを作成したいと考えています。ポイントからの距離にズームエフェクトベースを作成するには

  1. 私はすでに距離を持っています。
  2. 私はイメージを持っています。
  3. 私はズームキックその下の最大距離を有する。
+0

、新しいアプリケーションを作成するのを助けることができます。これまでに試したことや問題があることの詳細をいくつかお伝えしたいですか? –

答えて

0

コードに続いて、ピンの距離とズームパー使用です。

-(void) centerMap 

{ 
    MKCoordinateRegion region; 
    CLLocationDegrees maxLat = -90; 
    CLLocationDegrees maxLon = -180; 
    CLLocationDegrees minLat = 120; 
    CLLocationDegrees minLon = 150; 
    NSArray *temp=self.AS; 
// NSArray *temp=[NSArray arrayWithArray:[NSArray arrayWithArray:[reports objectAtIndex:0]]]; 
    for (int i=0; i<[temp count];i++) { 
     Place* home = [[[Place alloc] init] autorelease]; 
     home.latitude = [[[temp objectAtIndex:i] valueForKey:@"latitude"]floatValue]; 
     home.longitude =[[[temp objectAtIndex:i] valueForKey:@"longitude"]floatValue]; 

     PlaceMark* from = [[[PlaceMark alloc] initWithPlace:home] autorelease];  

     CLLocation* currentLocation = (CLLocation*)from ; 
     if(currentLocation.coordinate.latitude > maxLat) 
      maxLat = currentLocation.coordinate.latitude; 
     if(currentLocation.coordinate.latitude < minLat) 
      minLat = currentLocation.coordinate.latitude; 
     if(currentLocation.coordinate.longitude > maxLon) 
      maxLon = currentLocation.coordinate.longitude; 
     if(currentLocation.coordinate.longitude < minLon) 
      minLon = currentLocation.coordinate.longitude; 

     region.center.latitude  = (maxLat + minLat)/2; 
     region.center.longitude = (maxLon + minLon)/2; 
     region.span.latitudeDelta = maxLat - minLat; 
     region.span.longitudeDelta = maxLon - minLon; 
    } 
    [mapView setRegion:region animated:YES]; 

} 

- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation 
{ 

    if (annotation == mapView.userLocation) 
     return nil; 

    MKPinAnnotationView *pin = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier: @"asdf"]; 

    if (pin == nil) 
     pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: @"asdf"] autorelease]; 
    else 
     pin.annotation = annotation; 
    pin.userInteractionEnabled = YES; 
    UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
    [disclosureButton setFrame:CGRectMake(0, 0, 30, 30)]; 

    pin.rightCalloutAccessoryView = disclosureButton; 
    pin.pinColor = MKPinAnnotationColorRed; 
    //pin.animatesDrop = YES; 
    [pin setEnabled:YES]; 
    [pin setCanShowCallout:YES]; 
    return pin; 

} 

このコードは、私はそれはあなたがに問題があるが何であるかは明らかではよく分からない

+0

ありがとうございましたごめんなさい申し訳ございませんが、私はカメラ上に画像オーバーレイを持っていましたが、これは緯度経度からの距離に基づいてズームする必要がありました。 – amar

+0

大丈夫です –

関連する問題