我创建了一个自定义子类,UIImageView
并且在一种方法中,我想在图像加载时向中心添加一个活动指示器。我正在使用以下代码,但活动监视器位于UIImageView
. 我该怎么做才能将它准确地居中UIImageView
?
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
indicator.autoresizingMask =
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleBottomMargin |
UIViewAutoresizingFlexibleLeftMargin;
indicator.center = self.center;
[self addSubview:indicator];
[indicator startAnimating];