Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIRefreshControl在使用UIViewControler和UITableView切换UIAbbarController中的选项卡后卡住_Ios_Xcode_Uirefreshcontrol - Fatal编程技术网

Ios UIRefreshControl在使用UIViewControler和UITableView切换UIAbbarController中的选项卡后卡住

Ios UIRefreshControl在使用UIViewControler和UITableView切换UIAbbarController中的选项卡后卡住,ios,xcode,uirefreshcontrol,Ios,Xcode,Uirefreshcontrol,切换选项卡后,MyUIRefreshControl被卡住,它只发生在第一个选项卡上。在TabBar内部,我有两个带有UIViewControler的选项卡,其中我有UITableView 我尝试了所有建议的解决方案,但没有一个对我有效 下面是我正在做的事情 - (void)viewDidLoad { [super viewDidLoad]; data = [[NSMutableArray alloc] initWithArray:[[DataCache sharedCache] getData

切换选项卡后,My
UIRefreshControl
被卡住,它只发生在第一个选项卡上。在TabBar内部,我有两个带有UIViewControler的选项卡,其中我有UITableView

我尝试了所有建议的解决方案,但没有一个对我有效

下面是我正在做的事情

- (void)viewDidLoad {
[super viewDidLoad];

data = [[NSMutableArray alloc] initWithArray:[[DataCache sharedCache] getData]];

[self addNavBar];
[self addDataTable];

//for refreshing the table data
UITableViewController *tableViewController = [[UITableViewController alloc] init];
tableViewController.tableView = dataTable;
refreshControl = [[UIRefreshControl alloc] init];
refreshControl.backgroundColor = [UIColor purpleColor];
refreshControl.tintColor = [UIColor whiteColor];
[refreshControl addTarget:self
                   action:@selector(refresh)
         forControlEvents:UIControlEventValueChanged];
[dataTable addSubview:refreshControl];
tableViewController.refreshControl = refreshControl;
}


- (void)refresh {
[self loadSentData];
data = [[NSMutableArray alloc] initWithArray:[[DataCache sharedCache] getSentData]];
[self performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
}

- (void)reloadData{
[dataTable reloadData];
[refreshControl endRefreshing];
}

因为这个问题已经被看了几百遍了。在这里添加我的解决方案可能会帮助其他人


在我的例子中,这是由于
刷新控制
。两个视图都需要单独的
refreshControl
。我最终创建了
refreshControlFirstView
refreshControlSecondView
,解决了问题。

想要的行为是什么?它会卡在那里并且永远不会消失吗?通常的行为是
tableview
(dataTable)返回到相同的位置,
refreshView
会消失。这也是我们想要的行为。所以它卡在那里,永远不会消失?最初它工作正常,但在我转到选项卡2并刷新那里的数据,然后回到选项卡1并刷新数据后,选项卡1被卡在某个位置,它不会一直回到顶部。我可以再次将其向下拉,但它不会刷新数据,并且卡在该位置,背景中可以看到
UIRefreshControl
,我已添加了卡滞区域的图片不确定问题出在哪里。当它被卡住时,
reloadData
是否会被调用?