Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Forked from anonymous/gist:6079364
Created July 25, 2013 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonewebdesign/6079395 to your computer and use it in GitHub Desktop.
Save simonewebdesign/6079395 to your computer and use it in GitHub Desktop.
//
// DetailsController.m
// iOsNative
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment