0

저는 uipopovercontroller를 가지고 있고, uitableview 메소드의 didselectrowatindexpath 메소드에서 uiactivityindicatorview에 애니메이션을 적용하려고합니다. 여기 내 코드가있다.uiactivityindicatorview가 uipopoverviewcontroller iphone에서 작동하지 않습니다.

-(IBAction)btnA_Clicked:(id)sender{ 

    self.objuiviewCon = [[myuiviewController alloc] initWithNibName:@"myuiviewController" bundle:nil]; 
    [self.objuiviewCon setDelegate:self]; 

    self.ObjApopCon = [[UIPopoverController alloc] initWithContentViewController:self.objuiviewCon]; 
    [self.ObjApopCon setPopoverContentSize:CGSizeMake(self.objuiviewCon.view.frame.size.width, self.objuiviewCon.view.frame.size.height)]; 
    [self.ObjApopCon presentPopoverFromBarButtonItem:btnA permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

} 

@interface myuiviewController : UIViewController<UITableViewDelegate,UITableViewDataSource>{ 

IBOutlet UITableView *tblList; 

IBOutlet UIActivityIndicatorView *actiIndi; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 
    return [myarr count]; 
} 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    NSLog(@"cell called"); 

    cell.textLabel.text = [myarr objectAtIndex:indexPath.row]; 
    return cell; 
} 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSLog(@"didSelectRowAtIndexPath called"); 
    [actiIndi startAnimating]; 
} 

인터페이스 작성기와 위임에 연결된 모든 iboutle도 설정됩니다. 하지만 내 문제는 내 didSelectRowAtIndexPath 메서드를 호출하고 있지만 activityindicator 애니메이션되지 않습니다.

나는 webservice를 호출 할 때 프로토콜을 사용하여 테이블 뷰 행을 클릭하므로 웹 서비스의 출력을 얻을 때까지 애니메이션에 uiactivityindicatorview가 필요합니다.

모든 의견을 환영합니다.

답변

0

활동 및 테이블보기가 UITableView 뒤에있을 수 있습니다. UITctivityIndicator가 UITableView 뒤에 있습니다. 또한이 didSelectRowAtIndexPath에서 좀 더 코드가, 당신이 무슨 말을하는지 들어

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSLog(@"didSelectRowAtIndexPath called"); 
    [tableview bringSubviewToFront:actiIndi]; 
    [actiIndi startAnimating]; 
} 
+0

감사합니다. 코코아는 answering.it에 중요한 점은 tableview가 전면에 나타납니다. 그래서 행동은 표시되지 않습니다. –

0

을 숨길 수 없습니다 것 확인 :. 즉, 호출 된 메소드에서 webservice를 호출합니다.

나는 모든 문제가 당신이 동 기적으로 webservice를 호출하고 있다고 생각한다. 사용자 인터페이스의 모든 변경 사항은 메소드가 완료된 후에 만 ​​작동한다는 점을 명심해야합니다. 따라서 startAnimating은 주 인터페이스 루프로 제어를 반환하지 않는 경우 아무 작업도 수행하지 않습니다.

이 솔루션은, 당신은 대신의 웹 서비스를 호출하는 방법 호출 할 때 :

[actiIndi startAnimating]; 
[self callWebservice:fooObject]; 

쓰기이 : 다음 메인 루프로 제어를 반환하는

[actiIndi startAnimating]; 
[self performSelector:@selector(callWebservice:) withObject:fooObject afterDelay:0.0]; 

, 활동 표시기 가능한 한 빨리 다른 메소드가 호출됩니다.

+0

가브리엘에 대답 해 주셔서 감사합니다. 사실 나는 주석에 웹 서비스 호출을 넣었고 여전히 애니메이트하지 않는 표시기에 애니메이션을 적용하려고했습니다. –

+0

답변을 편집하고 해당 코드를 포함시켜주십시오. – Gabriel

+0

나는 모든 코드를 주석에 넣었다. 내 코드는 다음을 포함합니다. NSLog (@ "didSelectRowAtIndexPath 불렀다"); [actiIndi startAnimating]; –

관련 문제