2012-12-21 3 views
1

반환하기 때문에 내 JSON 문자열을 다운로드하려면 객체를 만들고 NSMutableArray allPartners에 넣으십시오. 어떻게 든 download 방법을 차단할 수 있습니까?"블록"방법은 numberOfRowsInSection 내 .H 파일이 0

업데이트 : allPartners이 방법으로 작성됩니다

[serviceConnector download]; 

-(void)download{ 

    //build up the request that is to be sent to the server 
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://www.bala.com"]]; 

    [request setHTTPMethod:@"GET"]; 
    [request addValue:@"getValues" forHTTPHeaderField:@"METHOD"]; //selects what task the server will perform 

    //initialize an NSURLConnection with the request 
    NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; 
    if(!connection){ 
     NSLog(@"Connection Failed"); 
    } 
} 
+0

ServiceConnector가 델리게이트를 통해 사용자에게 [table reloadData]를 수행 한 데이터가 있음을 사용자에게 알릴 때; 그리고 그게 다야. 그 사이에 빈 테이블이 생겨 거기에 대기중인 HUD가 표시되거나 "[allPartners count]가 0이면 1을 반환하고 셀에 일부 특수 내용을 채 웁니다."와 같은 논리를 수행 할 수 있습니다. – demosten

+0

다운로드 방법에 대한 코드를 추가하십시오. –

+0

[table reloadData]를 호출하는 방법을 알려 줄 수 있습니까? 다른 반 에서요? – doonot

답변

0

ServiceConnector는 당신이 [table reloadData]; 수행 데이터가 대리인을 통해 당신을 통지하고 그게 다야. 한편 비어있는 테이블을 가지고 거기에 대기중인 HUD를 표시하거나 if [allPartners count] is 0 then return count 1 and fill the cell with some special content과 같은 논리를 표시 할 수 있습니다.

관련 문제