2010-11-18 61 views
0

我正在写一个iPad应用程序,它具有UIWebView和活动指示器,当页面在webview中加载时。我认为这是一个愚蠢的问题,但我怎样才能确保活动指标始终居中?如果我把它放在垂直位置,它就会居中,但如果我水平放置iPad,则活动指示符现在位于左下象限中的某个位置,而不是中心。iPad集中活动指示器

在此先感谢!

回答

6
UIActivityIndicatorView *progress_ind = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; 
progress_ind.center = CGPointMake (self.view.bounds.size.width * 0.5F, self.view.bounds.size.height * 0.5F); 
[progress_ind startAnimating]; 
progress_ind.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); 

[self.view addSubview:progress_ind]; 
+0

这工作完美,谢谢jwarrent! – changus 2010-11-18 17:42:57