所以,我正在以编程方式创建activityIndicator。一切正常。现在我想为指标添加背景图像并将其置于视图中间。知道如何实现这个目标吗?
这是我的代码:
- (void) indicatorViewShow: (bool)show {
if (show) {
//--- create layout rect
CGRect indicatorRect;
indicatorRect.origin = self.view.center;
indicatorRect.size.width = 50;
indicatorRect.size.height = 50;
indicatorRect.origin.x -= indicatorRect.size.width / 2;
//--- create indicator view
indicatorView = [[IndicatorView alloc] initWithFrame: indicatorRect];
indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[indicatorView startAnimating];
[self.view addSubview: indicatorView];
//--- show network activity
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
} else {
//--- hide network activity
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[indicatorView stopAnimating];
//--- remove indicator view
indicatorView.hidden = YES;
[indicatorView release];
indicatorView = nil;
}
}
答案 0 :(得分:0)
您可以继承UIActivityIndicator,在该类中添加UIImageView,然后您有一个带有背景图像属性的活动指示器