これは私がしたことです:
@implementation BGUIActivityIndicator
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
[self customInitialize];
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
[self customInitialize];
return self;
}
-(void)customInitialize
{
UIView * theImageView= [self findASubViewforClass:[UIImageView class]];//
UIImageView * theImageView1 = (UIImageView *) theImageView;
theImageView1.image = [UIImage imageNamed:@"spinner_blue"];
[theImageView1.image saveScreenshot];
while (false) ;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
すべてが完璧に見えます。[theImageView1.image saveScreenshot]; 古いビューと新しいビューの両方を完全に書き留めます。
ただし、何も変わりません。なんで?
UIActivityIndicatorの画像を変更する方法を正確に尋ねているわけではありません。すでにたくさんあります。UIActivityIndicatorをサブクラス化して使用したいのは、これが最も洗練されたソリューションだと思うからです。私はそれをすることができないようです。
特に、たとえば検索コントローラーの背景を変更するために機能する私のアプローチが、なぜこれに機能しないのかを尋ねています。