UITableView 自定义拉动刷新视图不显示
UITableView custom pull to refresh view does not show up
我有以下代码用于我的自定义下拉刷新。
CGFloat customRefreshControlHeight = 50.0f;
CGFloat customRefreshControlWidth = 320.0f;
CGRect customRefreshControlFrame = CGRectMake(0.0f,
-customRefreshControlHeight,
customRefreshControlWidth,
customRefreshControlHeight);
TestRefreshView *refreshView = [[TestRefreshView alloc] init];
refreshView.frame = customRefreshControlFrame;
self.testRefreshView = refreshView;
[self.tableView addSubview: self.testRefreshView];
但是,当我下拉我的 table 时,这个视图并没有出现。还有什么我需要设置但我还遗漏的吗?
这是我在 UIrefreshController
:
中使用自定义 UIView
的示例
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.frame = CGRectMake(x,
y,
self.refreshControl.bounds.size.width,
self.refreshControl.bounds.size.height);
self.animIndView = [[AnimatorIndicatorView alloc] initWithFrame:self.refreshControl.frame];
[self.refreshControl addTarget:controller action:@selector(refrechLocation:) forControlEvents:UIControlEventValueChanged];
[self.refreshControl setTintColor:[UIColor clearColor]];
[controller.refreshControl addSubview:self.animIndView];
[self.tableView addSubview:self.refreshControl];
我有以下代码用于我的自定义下拉刷新。
CGFloat customRefreshControlHeight = 50.0f;
CGFloat customRefreshControlWidth = 320.0f;
CGRect customRefreshControlFrame = CGRectMake(0.0f,
-customRefreshControlHeight,
customRefreshControlWidth,
customRefreshControlHeight);
TestRefreshView *refreshView = [[TestRefreshView alloc] init];
refreshView.frame = customRefreshControlFrame;
self.testRefreshView = refreshView;
[self.tableView addSubview: self.testRefreshView];
但是,当我下拉我的 table 时,这个视图并没有出现。还有什么我需要设置但我还遗漏的吗?
这是我在 UIrefreshController
:
UIView
的示例
self.refreshControl = [[UIRefreshControl alloc] init];
self.refreshControl.frame = CGRectMake(x,
y,
self.refreshControl.bounds.size.width,
self.refreshControl.bounds.size.height);
self.animIndView = [[AnimatorIndicatorView alloc] initWithFrame:self.refreshControl.frame];
[self.refreshControl addTarget:controller action:@selector(refrechLocation:) forControlEvents:UIControlEventValueChanged];
[self.refreshControl setTintColor:[UIColor clearColor]];
[controller.refreshControl addSubview:self.animIndView];
[self.tableView addSubview:self.refreshControl];