Skip to content

Instantly share code, notes, and snippets.

@jontelang
Created July 23, 2013 05:47
Show Gist options
  • Save jontelang/6060125 to your computer and use it in GitHub Desktop.
Save jontelang/6060125 to your computer and use it in GitHub Desktop.
ad
#include "_own_/Preferences5/Preferences.h"
@interface PathCell : PSTableCell <PreferencesTableCustomView,UIGestureRecognizerDelegate>
{
NSArray * directoryContents;
}
@end
@implementation PathCell
- (id)initWithSpecifier:(PSSpecifier *)specifier
{
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell" specifier:specifier];
if (self)
{
self.backgroundColor = [UIColor redColor];
NSError * error;
directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"Library/XPasscode/" error:&error];
NSLog(@"%@",directoryContents);
for (int i = 0; i < [directoryContents count]; i++)
{
UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(0,i*50,320,50)];
l.text = [directoryContents objectAtIndex:i];
l.textAlignment = NSTextAlignmentCenter;
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[l addGestureRecognizer:tap];
[tap release];
[self addSubview:l];
}
}
return self;
}
- (float)preferredHeightForWidth:(float)arg1
{
// Return a custom cell height.
return [directoryContents count] * 50;
}
-(void)handleTap:(UITapGestureRecognizer *)sender
{
NSLog(@"%@",sender);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment