// // DetailsController.m // iOsNative // // Created by Nicole De La Feld on 7/17/13. // Copyright (c) 2013 Nicole De La Feld. All rights reserved. // #import "DetailsController.h" #import "CustomDetailsCell.h" #import "JsonReader.h" #import "PList.h" @implementation DetailsController @synthesize details, props, rowIndex; PList *strings; int i = 0; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; [self getDetails : rowIndex]; } -(NSMutableArray*)getDetails:(NSIndexPath*)row { props = [[NSMutableArray alloc]initWithObjects: @"id", @"filedate", @"realname", @"filetype", @"filesize", @"fileauthor", @"submittedby", @"icon", @"downloads", @"userupload", @"containerid", @"registered", @"chunkcount", @"description", nil ]; details = [[NSMutableArray alloc]init]; for (NSString *prop in props){ strings = [[PList alloc]init]; strings.title= prop.uppercaseString; // strings.Description = [[[JsonReader alloc] readDocuments] valueForKey:prop]; [details addObject:strings]; } return details; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)Download:(UIButton *)sender { // [[JsonReader alloc]downloadFile]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *) tableView { return 1; } -(NSInteger) tableView: (UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.props count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = (CustomDetailsCell*)[tableView dequeueReusableCellWithIdentifier:@"details_cell"]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"details_cell"]; } NSDictionary* currentrow = [self.props objectAtIndex:i]; UILabel *txtTitle = (UILabel*)[cell viewWithTag:1]; UILabel *txtDescription = (UILabel*)[cell viewWithTag:2]; txtTitle.text = [[details objectAtIndex:i] title] ; // txtDescription.text = [[details objectAtIndex:i]Description]; i = i+1; return cell; } @end