【发布时间】:2015-07-02 14:45:48
【问题描述】:
我正在尝试使 UIActivityIndicator 与 UIRefreshControl 中的 on 大小相同,因为有时我需要手动刷新屏幕,有时无需拉动屏幕即可刷新数据,因此我需要模拟活动指示器。
_refreshControl = [[UIRefreshControl alloc] init];
_refreshControl.tintColor = [UIColor grayColor];
[_refreshControl addTarget:self action:@selector(refreshItems) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:_refreshControl];
UIView *activityIndicatorWrapper = [[UIView alloc] initWithFrame:_refreshControl.frame];
[self.collectionView addSubview:activityIndicatorWrapper];
_activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicatorWrapper.frame = _refreshControl.bounds;
[activityIndicatorWrapper addSubview:_activityIndicator];
[_activityIndicator startAnimating];
[_activityIndicator autoCenterInSuperview];
_activityIndicator.hidesWhenStopped = YES;
问题是尺寸不同,即使我把它们做成同一个框架..
【问题讨论】:
标签: ios uiactivityindicatorview uirefreshcontrol