Commit cc9acf2c authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne

add pull to refresh network

Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent b19870da
......@@ -32,6 +32,8 @@
NSArray *_UPNPdevices;
VLCNetworkLoginViewController *_loginViewController;
UIRefreshControl *refreshControl;
}
@end
......@@ -74,6 +76,14 @@
_netServiceBrowser = [[NSNetServiceBrowser alloc] init];
_netServiceBrowser.delegate = self;
// Active le Pull down to refresh
refreshControl = [[UIRefreshControl alloc] init];
// call the refresh function
[refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
[self.tableView addSubview:refreshControl];
}
- (void)viewWillDisappear:(BOOL)animated
......@@ -224,6 +234,25 @@
}
}
#pragma mark - Refresh
-(void)handleRefresh
{
//set the title while refreshing
refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"Refresh"];
//set the date and time of refreshing
NSDateFormatter *formattedDate = [[NSDateFormatter alloc]init];
[formattedDate setDateFormat:@"MMM d, h:mm a"];
NSString *lastupdated = [NSString stringWithFormat:@"Last Updated on %@",[formattedDate stringFromDate:[NSDate date]]];
refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:lastupdated];
//end the refreshing
[refreshControl endRefreshing];
[self.tableView reloadData];
[self performSelectorInBackground:@selector(_startUPNPDiscovery) withObject:nil];
}
#pragma mark - login panel protocol
- (void)loginToURL:(NSURL *)url confirmedWithUsername:(NSString *)username andPassword:(NSString *)password
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment