第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

沒有UITableViewController的UIRefreshControl

沒有UITableViewController的UIRefreshControl

浮云間 2019-07-22 10:35:44
沒有UITableViewController的UIRefreshControl只是好奇,因?yàn)檫@看起來不可能,但有沒有一種詭秘的方法來利用新的iOS 6UIRefreshControl不使用UITableViewController子類?我經(jīng)常使用UIViewController帶著UITableView子視圖和符合UITableViewDataSource和UITableViewDelegate而不是使用UITableViewController徹頭徹尾的。
查看完整描述

3 回答

?
搖曳的薔薇

TA貢獻(xiàn)1793條經(jīng)驗(yàn) 獲得超6個贊

憑直覺,基于DrummerB的靈感,我嘗試簡單地添加一個UIRefreshControl實(shí)例作為我的UITableView..神奇地起作用了!

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];[self.myTableView addSubview:refreshControl];

這增加了一個UIRefreshControl在您的表視圖之上并按預(yù)期工作,而不必使用UITableViewController :)


編輯:上面仍然有效,但是正如一些人所指出的,在以這種方式添加UIRefreshControl時,有一個輕微的“口吃”。解決方案之一是實(shí)例化UITableViewController,然后將UIRefreshControl和UITableView設(shè)置為此,即:

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


查看完整回答
反對 回復(fù) 2019-07-22
?
紅糖糍粑

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超6個贊

若要消除由接受的答案引起的口吃,您可以分配UITableView轉(zhuǎn)到UITableViewController.

_tableViewController = [[UITableViewController alloc]initWithStyle:UITableViewStylePlain];[self addChildViewController:_tableViewController];_tableViewController.refreshControl = [UIRefreshControl new];[_tableViewController.refreshControl addTarget:self action:@selector(loadStream) forControlEvents:UIControlEventValueChanged];_theTableView = _tableViewController.tableView;

編輯:

添加UIRefreshControl沒有UITableViewController沒有口吃和保留良好的動畫后刷新數(shù)據(jù)的表視圖。

UIRefreshControl *refreshControl = [UIRefreshControl new];[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];[self.theTableView addSubview:refreshControl];[self.theTableView sendSubviewToBack:refreshControl];

稍后在處理刷新數(shù)據(jù)時.。

- (void)handleRefresh:(UIRefreshControl *)refreshControl {
    [self.theTableView reloadData];
    [self.theTableView layoutIfNeeded];
    [refreshControl endRefreshing];}


查看完整回答
反對 回復(fù) 2019-07-22
?
冉冉說

TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超1個贊

您要嘗試的是在您正在使用的ViewController中使用容器視圖。您可以使用專用的表視圖定義干凈的UITableViewController子類,并將其放在ViewController中。


查看完整回答
反對 回復(fù) 2019-07-22
  • 3 回答
  • 0 關(guān)注
  • 462 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號