UIRefreshControl没有刷新xml数据

时间:2014-01-30 03:35:54

标签: objective-c ios7

我是新来的,我很难过尝试添加一个pull来刷新控件来更新我的xml表视图。我正在获得适当的拉动以刷新动画,但数据并不令人耳目一新。请帮忙。

- (void)viewDidLoad {
    [super viewDidLoad];
    feeds = [[NSMutableArray alloc] init];
    NSURL *url = [NSURL URLWithString:@"http://www.PLACEHOLDER.rss.xml"];
    parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
    [parser setDelegate:self];
    [parser setShouldResolveExternalEntities:NO];
    [parser parse];
    UIRefreshControl *refreshControl = [UIRefreshControl new];
    [refreshControl addTarget:self action:@selector(refresh:) 
        forControlEvents:UIControlEventValueChanged];
    refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull 
        to refresh..."];
    self.refreshControl = refreshControl;

}

- (void)refresh:(UIRefreshControl *)sender {
    // ...refresh code
    NSURL *url = [NSURL URLWithString:@"http://www.PLACEHOLDER.rss.xml"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    (void)[[NSURLConnection alloc] initWithRequest:request delegate:self];

    [sender endRefreshing];
}

0 个答案:

没有答案