gpt4 book ai didi

ios - 使 UIActivityIndi​​cator 与 UIRefreshControl 中的 on 大小相同

转载 作者:行者123 更新时间:2023-12-01 16:31:57 25 4
gpt4 key购买 nike

我正在尝试使 UIActivityIndi​​cator 的大小与 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;

问题是尺寸不同,即使我把它们做成相同的框架..

最佳答案

我也试过这样做。我认为这是不可能的,尤其是因为我们看不到 UIKit 在幕后做了什么。

关于ios - 使 UIActivityIndi​​cator 与 UIRefreshControl 中的 on 大小相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31187724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com