2010-09-20 80 views
1

我掙扎着,將近1小時也我無法弄清楚如何在UITableView中顯示UIactivity指標,因爲我不能在iPhone上使用IB中的UITableView(它不是拖動)如何在UITableView中顯示UIActivityindicator上iphone

我用這個和它的工作 ,但我想在viewDidLoad中

顯示
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{ 

//loadingView =[LoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0]];//.window.subviews 
    NSLog(@"dgdddddddddddddddddddd"); 
    UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(130, 10, 25, 25)]; 

    //UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 30.0, 320.0, 60.0)]; 
    activityView.center=customView.center; 
    [activityView startAnimating]; 
    [ customView bringSubviewToFront:activityView]; 
    [customView addSubview:activityView];// [headerLabel release]; 

    return [customView autorelease];  
} 

好心建議

回答

2

如果該文件的視圖屬性鏈接到的UITableView,那麼子視圖不會被添加。嘗試使用包含表視圖的普通視圖替換視圖屬性,然後嘗試添加指示器。也嘗試將文件所有者類從uitableviewcontroller創建爲uiviewcontroller類。

+0

是的,謝謝:-)現在它的工作 – prajakta 2010-09-23 06:03:45

+0

如果你找到有用的答案請投票 – Nareshkumar 2010-10-27 05:55:39

+0

我只是很困惑!爲什麼這樣? viewController的視圖屬性在這裏做的最少,因爲活動指示器作爲子視圖被添加到標題視圖。 viewController的視圖屬性與它有什麼關係? – 2011-02-17 09:36:06