2016-05-13 6 views
0

私のUIViewControllerには、サブビューの1つとしてUITableViewがあります。私はUITableViewControllerを使用しています私のアプリで別の画面を持っており、そのUIRefreshControlは私UITableViewのために加え1以上の方法より異なりますiOS - UITableViewのUIRefreshControl対UITableViewControllerのUIRefreshControl

// enable "pull to refresh" 
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; 
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull To Refresh!" attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : [UIFont systemFontOfSize:17]}]; 
[refreshControl addTarget:self action:@selector(fetchArticles) forControlEvents:UIControlEventValueChanged]; 
refreshControl.backgroundColor = [UIColor colorWithRed:0.0f/255.0f green:102.0f/255.0f blue:153.0f/255.0f alpha:1.0]; 
refreshControl.tintColor = [UIColor whiteColor]; 
self.refreshControl = refreshControl; 
[self.tableView addSubview:self.refreshControl]; 

:私は、次のコードで私のUIRefreshControlを追加します。

別のUITableViewUIRefreshControlは、ドラッグすると処理が遅くなります。通常、リフレッシュを開始するには、FARTHERをドラッグする必要があります。

私の他の画面のUITableViewControllerUIRefreshControlは、ドラッグすると高速ですが、これまでにドラッグしてリフレッシュを開始する必要はありません。

私はUITableViewControllerさんUIRefreshControlのスムーズな動作を好むので、どのように私は私のための私のUITableViewUIRefreshControlがよりUITableViewControllerに属し、デフォルトの1のように動作するのですか?

これは可能ですか?または、UIContainerViewを使用し、UITableViewController私の唯一のオプションを使用していますか?

答えて

1

UIRefreshControlは、UITableViewControllerで動作するように設計されています。 Appleのウェブサイトには書かれています:

リフレッシュ制御は、具体的にテーブルビューコントローラによって管理されますテーブルビューで使用するために設計されているため、異なるコンテキストでそれを使用すると、未定義の動作が発生することができます。

つまり、人々はUITableViewControllerUIRefreshControl without UITableViewControllerなしで成功しています。自己責任。

+0

リンクありがとうございます!私はちょっとハッキリした 'UITableViewController'インスタンスソリューションを使用することを躊躇しましたが、それは完全に機能しました! – Rafi

関連する問題