[UIRefreshControl setRefreshControlState:]:发送到解除分配的实例的消息

时间:2015-07-16 04:01:08

标签: ios objective-c uicollectionview dealloc uirefreshcontrol

我有setPaginationEnabled(boolean paginationEnabled); 作为UIRefreshControl的子视图。我的问题是我在viewController被释放后调用了我作为refreshControl目标添加的选择器。以下是我设置refreshControl的方法。

UICollectionView

在dealloc中,我试图说出这个:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refreshMedia:) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:refreshControl];
refreshControl.tintColor = [UIColor grayColor];
self.refreshControl = refreshControl;
[self.collectionView setBounces:YES];
self.collectionView.alwaysBounceVertical = YES;

这是我的错误信息:

-(void)dealloc{
    self.collectionView.delegate = nil;
    self.collectionView.dataSource = nil;
    [self.refreshControl endRefreshing];
    [self.refreshControl removeTarget:self action:NULL forControlEvents:UIControlEventValueChanged];
    self.refreshControl = nil;
}

0 个答案:

没有答案