0

기사를 읽는 앱을 만들고 있습니다. 나는 메뉴 목록에 AMSliderMenu (https://github.com/SocialObjects-Software/AMSlideMenu) 라이브러리를 사용하고 있습니다. 내가 그것을 데이터를로드 꽃밥보기에 있기 때문에 다른보기를로드하는 데 시간이 걸립니다 에서 테이블 셀에 AMSlideMenu을 클릭하면seague 수행 중 UIActivityIndicatorView 방법은 무엇입니까?

나는 UIActivityIndicator를 구현 드릴 수 없습니다.

UIActivityIndicator 사용자가 UIActivityIndicator 셀을 클릭하면 다른보기를 열 때까지 수행하고 싶습니다.

 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
     { 

      UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 
      spinner.center = CGPointMake(160, 240); 
      spinner.hidesWhenStopped = YES; 
      [self.view addSubview:spinner]; 
     [spinner startAnimating]; 
      dispatch_queue_t downloadQueue = dispatch_queue_create("downloader", NULL); 
      dispatch_async(downloadQueue, ^{ 
     [NSThread sleepForTimeInterval:10]; 
     dispatch_async(dispatch_get_main_queue(), ^{ 
     [spinner stopAnimating]; 

     }); 

    }); 
    NSString *segueIdentifier = [self.mainVC segueIdentifierForIndexPathInLeftMenu:indexPath]; 

     if (segueIdentifier && segueIdentifier.length > 0) 
     { 
     [self performSegueWithIdentifier:segueIdentifier sender:self]; 
      } 
     } 
+0

은 무엇을 할 때 당신의 보도 셀됩니까? BTW, 고려 MBProgressHud https://github.com/jdg/MBProgressHUD. – kelin

+0

왜 MBProgressHUD를 사용하지 않습니까? 그 중 하나가 최고 – sreekanthk

답변

2

는 클래스 수준 범위에서 UIActivityIndicatorView를 선언 :

여기 내 코드입니다.

UIActivityIndicatorView *spinner; 

메인 큐의 SEGUE를 수행하십시오 SEGUE을 할 때

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 
    spinner.center = CGPointMake(160, 240); 
    spinner.hidesWhenStopped = YES; 
    [self.view addSubview:spinner]; 
    [spinner startAnimating]; 
    dispatch_queue_t downloadQueue = dispatch_queue_create("downloader", NULL); 
    dispatch_async(downloadQueue, ^{ 
    [NSThread sleepForTimeInterval:10]; 
     dispatch_async(dispatch_get_main_queue(), ^{ 
      NSString *segueIdentifier = [self.mainVC segueIdentifierForIndexPathInLeftMenu:indexPath]; 
      if (segueIdentifier && segueIdentifier.length > 0){ 
       [self performSegueWithIdentifier:segueIdentifier sender:self]; 
      }else{ 
       [spinner stopAnimating]; 
      } 
     }); 
    }); 
} 

는 회 전자를 중지

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    [spinner stopAnimating]; 
} 
+0

덕분에 많이! 메다, 잘 작동 해요. – Daljeet