나는 오른쪽 액세서리보기로 단추가있는 주석이있는 mapView가 있습니다. 특수 효과 세부 정보가 나타나 자마자 버튼을 누르면 필요한 정보를 다운로드 할 시간이 없기 때문에 세부 정보가 비어있는 것처럼 보입니다. 내가 찾는 것은 정보가 다운로드되는 한 활동 표시기를 보여주는 것입니다.주석 액세서리로 활동 표시기
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation{
popButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 31, 31)];
[popButton addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];
activityI = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 31, 31)];
[activityI startAnimating];
[popButton addSubview:activityI];
[NSThread detachNewThreadSelector:@selector(threadInfo:) toTarget:self withObject:annotation];
.
.
.
annView.rightCalloutAccessoryView = popButton;
}
-(void) threadInfo: (MKAnnotationView*) info{
while ([activityI isAnimating]) {
if (ok ==0) {
}
else{
NSLog(@"ok = %i",ok);
popButton = (UIButton*) info.rightCalloutAccessoryView; <--error*
popButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[activityI removeFromSuperview];
[activityI stopAnimating];
ok=0;
}
}
}
는 여기서 "확인"= 정수 1이 과정을 다운로드하여 성공적으로
오류 = 의한 캐치되지 않는 예외 'NSInvalidArgumentException'응용 프로그램 종료, 이유는
완료 = 때 여기서 : 여기에 지금까지 내가 무엇을 가지고 '- [ "주석 클래스 이름은"rightCalloutAccessoryView] : (모든 것을 통신 : 인식 할 수없는 선택기 예를 0x17e7fc60 '나는 activityI 여전히 충돌없이 애니메이션 버튼을 주석도..
업데이트로 전송 ented out은 테스트를 거쳤으며 동시에 작동하지 않습니다. 주석되지 뭐든지 ...) 내 마지막 시도했다
-(void) threadInfo: (MKAnnotationView*) annView{
UIButton* popButtons = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 31, 31)];
act = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 31, 31)];
[act setColor:[UIColor greenColor]];
[act startAnimating];
[popButtons addSubview:act];
while ([act isAnimating]) {
if (ok ==0) {
NSLog(@"ok = %i",ok);
}
else{
NSLog(@"ok = %i",ok);
// popButton = (UIButton*) annView.rightCalloutAccessoryView;
//UIButton* popButtons = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 31, 31)];
popButtons = [UIButton buttonWithType:UIButtonTypeInfoLight];
// UIActivityIndicatorView *currentActivityIndicator = (UIActivityIndicatorView *)[popButton viewWithTag:15];
//currentActivityIndicator.hidden = YES;
//[popButtons addSubview:[(UIActivityIndicatorView*) [popButton viewWithTag:15]]];
// [(UIActivityIndicatorView *) [popButton viewWithTag:15] stopAnimating];
// [(UIActivityIndicatorView *) [popButton viewWithTag:15] removeFromSuperview];
annView.rightCalloutAccessoryView = popButtons;
//[popButton addSubview:popButtons];
// NSLog(@"view = %@",[popButton viewWithTag:15]);
//[act stopAnimating];
// [currentActivityIndicator stopAnimating];
// [currentActivityIndicator removeFromSuperview];
// popButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
//ok=0;
}
}
}
[NSThread detachNewThreadSelector : @] 메서드에서 annView 대신 annot을 보내고 있다는 것을 알고 있습니다. selector (threadInfo :) toTarget : self withObject : annotation]; – user247
어떻게 해결할 수 있다고 제안하나요? 고맙습니다. – user1780591
이 메소드에서 annotation을 annView로 변경합니다. [NSThread detachNewThreadSelector : @selector (threadInfo :) toTarget : self withObject : annotation]; – user247