// // ScanUserListViewController.m // HMLG Scan Order // // Created by Rui Zhang on 2/22/22. // Copyright © 2022 United Software Applications, Inc. All rights reserved. // #import "ScanUserListViewController.h" #import "RAUtils.h" @interface ScanUserListViewController () @end @implementation ScanUserListViewController - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Select User"; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documents = [paths objectAtIndex:0]; NSString* unZipTo=[documents stringByAppendingPathComponent:@"download"]; NSString* file = [unZipTo stringByAppendingPathComponent:@"offlineOrderUsers.json"]; self.user_list = [RAUtils dictfromfile:file]; // Do any additional setup after loading the view. } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.user_list.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; // UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.textLabel.text = self.user_list[indexPath.item]; return cell; } - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if(self.returnValue) self.returnValue(self.user_list[indexPath.item]); [self dismissViewControllerAnimated:TRUE completion:nil]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end