我有uipopovercontroller有uitableview,我想在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動畫,直到得到webservice的輸出。
任何建議將不勝感激。
謝謝Cocoa Matters for answering.it將桌面帶到前臺。所以actiIndi不會顯示。 – 2012-07-18 05:24:06