问题
Im new here and am stumped trying to add a pull to refresh control to update my xml table view. I'm getting the proper pull to refresh animation, but the data is not refreshing. Please help.
- (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];
}
来源:https://stackoverflow.com/questions/21447330/uirefreshcontrol-not-refreshing-xml-data