2012-03-11 2 views
0

MKAnnotationView의 disclosureDetailButton을 UIActivityIndicatorView로 바꿀 수 없습니다.MKAnnotationView의 UIActivityIndicatorView로 disclosureDetailButton을 바꾸는 방법

내 코드는 여기 여기

-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)aView 
    calloutAccessoryControlTapped:(UIControl *)control 
{ 
     UIActivityIndicatorView * spinner = [[UIActivityIndicatorView alloc] 
      initWithFrame:CGRectMake(0, 0, 31, 31)]; 
     [spinner startAnimating]; 
     [aView addSubview:spinner]; 
     [self performSegueWithIdentifier:@"photoMap" sender:self]; 
} 

입니다 내가 annoView.rightCalloutAccessoryView에 스피너를 할당하면, 매핑 할 SEGUE을 준비 코드를, 그것은 충돌 할

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([segue.identifier isEqualToString:@"photoMap"]) 
{ 
     NSLog(@"the value is %i",(int)self.annotationValue); 
     UIActivityIndicatorView * spinner = [[UIActivityIndicatorView alloc]  initWithFrame:CGRectMake(0, 0, 31, 31)]; 
     [spinner startAnimating]; 

     MKPinAnnotationView * annoView = [self.annotations objectAtIndex:(NSUInteger)self.annotationValue]; 
     annoView.rightCalloutAccessoryView = spinner;//crash here!!!!! 
     SecViewController *newVC = segue.destinationViewController; 
     dispatch_queue_t downloadQueue = dispatch_queue_create("photos downloader", NULL); 
     dispatch_async(downloadQueue, ^{ 
     NSArray *photos = [FlickrFetcher photosInPlace:[self.places objectAtIndex: (NSUInteger)self.annotationValue] maxResults:50]; 
     dispatch_async(dispatch_get_main_queue(), ^{ 
     [newVC setPhotos:photos]; 
     [newVC setAnnotationValue:self.annotationValue]; 
     [newVC setPlaces:self.places]; 
     newVC.delegate = self; 
      }); 
    }); 
    dispatch_release(downloadQueue); 
    } 

}

+0

* 코드 블록은 4 칸으로 들여 쓰기해야합니다. 백틱은 코드의 * 인라인 * 스 니펫을위한 것입니다. –

+0

나는 더 새롭다, gocha, thx – user1250152

답변

2

스피너를 aView.rightCalloutAccessoryView에 할당합니다.

+0

는 일하지 않았다, 나는 그것을 실에 넣지 않았다, 그것은 중요합니까? – user1250152

+0

그게 효과가 있다고 생각합니다. 시도한 코드를 게시하십시오. –

+0

위에 코드를 추가했습니다 – user1250152

관련 문제