2

TVCを更新できません。下にドラッグして更新するとクラッシュします。アイコンはありますが、終了します。シンプルなものだと確信しています。考慮されていない同様の質問があります。

私のviewDidLoadメソッド本体から取得:

refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self
                   action:@selector(refreshInvoked:forState:)
         forControlEvents:UIControlEventValueChanged];
[self.tableView addSubview:refreshControl];

refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:title
                                                            attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:13.0]}];
[self refreshFeed];

これは次のことを指します:

-(void)refreshFeed 
{
   RSSLoader* rss = [[RSSLoader alloc] init];    
   [rss fetchRssWithURL:feedURL
            complete:^(NSString *title, NSArray *results) {
                dispatch_queue_t downloadQueue = dispatch_queue_create("downloader",NULL);
                dispatch_async(downloadQueue, ^{
                _objects = results;
                    [self.tableView reloadData];
                //completed fetching the RSS
                dispatch_async(dispatch_get_main_queue(), ^{
     //               [(HeaderView*)self.tableView.tableHeaderView setText:title];
                    // [(ArticleItem*)self.tableView.]
                });
                });
    }];
}
4

2 に答える 2

4

UIRefreshControl はサブビューとして追加することを意図したものではありません...そうすると問題が発生し、VC dealloc でターゲットを登録解除する必要があります...そうしないと、UIRefreshControl がデッド VC を呼び出すときに問題が発生する可能性があります ( VC への弱参照または強参照を保持しないでください)

于 2013-10-01T16:29:17.550 に答える
3

アクション メソッドを次のように変更します。

[refreshControl addTarget:self
                   action:@selector(refreshFeed)
         forControlEvents:UIControlEventValueChanged];

自分自身に存在しないものを指してrefreshInvoked:forState:いたようです。

于 2013-02-25T22:32:51.047 に答える