2013-01-31 4 views
0

단추의 오른쪽에 단추가 있고 왼쪽에 레이블이있는 사용자 지정 주석을 만들었습니다.사용자 정의 주석 단추

그것은 잘 나타나고 레이블 텍스트가 완전히 바뀌고 있지만, 어떤 이유로 버튼을 클릭해도 반응하지 않습니다. IBAction을 연결 했으므로 제대로 작동합니다. 그러나 그것은 단지 내 IBAction이라고 부르지 않습니다.

이 버튼이 내 터치를 무시하는 이유는 누구입니까?

덕분에,

+0

plz 게시물 ur 코드 .... – IronManGill

+0

코드 없이는 추측 할 수 없습니다. –

답변

0
  (MKAnnotationView *)mapView:(MKMapView *)aMapView 
        viewForAnnotation:(id)ann 
     { 

     NSString *identifier = @”myPin”; 
     MKPinAnnotationView *pin = (MKPinAnnotationView *) 
     [aMapView dequeueReusableAnnotationViewWithIdentifier:identifier]; 
     if (pin == nil) { 
       pin = [[[MKPinAnnotationView alloc] initWithAnnotation:ann 
                  reuseIdentifier:identifier] 
         autorelease]; 
     } else { 
       pin.annotation = ann; 
     } 


     //---display a disclosure button on the right--- 
     UIButton *myDetailButton = 
     [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     myDetailButton.frame = CGRectMake(0, 0, 23, 23); 
     myDetailButton.contentVerticalAlignment = 
     UIControlContentVerticalAlignmentCenter; 
     myDetailButton.contentHorizontalAlignment = 
     UIControlContentHorizontalAlignmentCenter; 

     [myDetailButton addTarget:self 
           action:@selector (checkButtonTapped:) 
        forControlEvents:UIControlEventTouchUpInside]; 

     pin.rightCalloutAccessoryView = myDetailButton; 
     pin.enabled = YES; 
     pin.animatesDrop=TRUE; 
     pin.canShowCallout=YES; 

     return pin; 
    } 



    -(void) checkButtonTapped:(id) sender 
     { 

     //---know which button was clicked; 
     // useful for multiple pins on the map--- 
     // UIControl *btnClicked = sender; 
     UIAlertView *alert = 
     [[UIAlertView alloc] initWithTitle:@”Your Current Location” 
             message :location 
             delegate:self 
          cancelButtonTitle:@”OK” 
          otherButtonTitles:nil]; 
     [alert show]; 
     [alert release]; 
     } 

난 내 프로젝트에서이 코드를 사용하고이 시도 할 수 있도록 나를 위해 잘 작동합니다.

관련 문제