2016-04-13 12 views
0

çalışmıyor. Başka bir deyişle, bazen aşağı çekerken yenileme işlevini çağırmaz. Bunu nasıl çözebilirim?UIRefreshControl benim toplama görünümüne bir <code>UIRefreshControl</code> eklemiş toplama görünümünde

+0

, bir UITableViewController kullanıyor veya normal UIViewController'da bir UITableView var mı? – Fonix

+0

eğer ikincisiyse, [bu cevap] (http://stackoverflow.com/a/26033824/1219956) – Fonix

+0

adresine bakın. Http://stackoverflow.com/questions/14718850/uirefreshcontrol-beginrefreshing-not-working-when- uitableviewcontroller-is-ins – kb920

cevap

0
#pragma mark UIRefreshControl 

- (void) setUpRefreshControl { 
    UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; 
    [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged]; 

    //add UIRefreshControl to Collection view 
    [self.collectionView addSubview:refreshControl]; 
} 

- (void)refresh:(id)sender 
{ 
    UIRefreshControl *refreshControl = (UIRefreshControl *)sender; 

    // End the refreshing 
    if (refreshControl) { 
     [refreshControl endRefreshing]; 
    } 

} 
0

Eğer UITableViewController sınıfını kullanmıyorsanız, o zaman

UITableViewController *tableViewController = [[UITableViewController alloc] init]; 
tableViewController.tableView = self.myTableView; 
self.refreshControl = [[UIRefreshControl alloc] init]; 
[self.refreshControl addTarget:self action:@selector(refreshTV:) forControlEvents:UIControlEventValueChanged]; 
tableViewController.refreshControl = self.refreshControl; 

- (void)refreshTV:(UIRefreshControl *)refresh{ 
     NSLog(@"Refresh"); 
     [refresh endRefreshing]; 
} 
0

aşağıda do İşte UIRefreshControl bir örnektir. aslında aşağıda refreshTV varken

UIRefreshControl *control = [[UIRefreshControl alloc] initWithFrame:CGRectZero]; 
control.tintColor = someColor; 
[control sizeToFit]; 
[tableView addSubview:control]; 
0

Sen yenileme kontrolü için hedef işlevi olarak refreshCV ekleyin. Gerçekten hangi işlevi istediğinizden emin olmak için kontrol edin.

+0

hata ile ayarlayın –