2011-01-29 28 views
0

以下代碼用於顯示下載進度。操作單顯示,執行下載的代碼在不同的線程上運行,並隨着進程更新進度。我已經使用調試器確認了這一點。問題是實際的進度條從不顯示在動作表上。每次更新後我都會延遲1秒,以確保我不會錯過它。有沒有什麼我失蹤至於設置酒吧?進度條不顯示在操作單上

self.pActionSheet=[[[UIActionSheet alloc] initWithTitle:@"Downloading Alerts. Please Wait.\n\n\n" delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil] autorelease]; 
pBarView=[[UIProgressView alloc] initWithFrame:CGRectMake(0.0f,40.0f, 220.0f, 90.0f)]; 
[pBarView setProgressViewStyle:UIProgressViewStyleDefault]; 
[pActionSheet addSubview:pBarView]; 
[pBarView release]; 
[pBarView setProgress:0.0f]; 
[pActionSheet showInView:self.view]; 
pBarView.center=CGPointMake(pActionSheet.center.x,pActionSheet.center.y); 

回答

0

事實證明,這是問題:

pBarView.center=CGPointMake(pActionSheet.center.x,pActionSheet.center.y); 

必須已經把它的視圖。當我手動指定一些座標時,它顯示正常。