Fix table crash, Use modal EmulatorView

The current layout does not yet support the sliding view. The requires
and update and / or replacement of the backend library.
This commit is contained in:
TwistedUmbrella 2015-08-23 14:04:52 -04:00
parent 458492f611
commit d106f541e6
3 changed files with 14 additions and 14 deletions

View File

@ -36,7 +36,7 @@
<connections> <connections>
<outlet property="diskImage" destination="6Qh-mW-Z9j" id="kv2-En-yNt"/> <outlet property="diskImage" destination="6Qh-mW-Z9j" id="kv2-En-yNt"/>
<outlet property="nameLabel" destination="Epl-iu-f5s" id="Tyn-LD-ioh"/> <outlet property="nameLabel" destination="Epl-iu-f5s" id="Tyn-LD-ioh"/>
<segue destination="WRM-pR-XCP" kind="push" identifier="emulatorView" id="xKH-h0-TDD"/> <segue destination="WRM-pR-XCP" kind="modal" identifier="emulatorView" id="xKH-h0-TDD"/>
</connections> </connections>
</tableViewCell> </tableViewCell>
</prototypes> </prototypes>

View File

@ -8,7 +8,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface PathsViewController : UITableViewController @interface PathsViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIBarButtonItem *sidebarButton; @property (weak, nonatomic) IBOutlet UIBarButtonItem *sidebarButton;
@property (nonatomic, strong) NSMutableArray* diskImages; @property (nonatomic, strong) NSMutableArray* diskImages;

View File

@ -7,7 +7,7 @@
// //
#import "PathsViewController.h" #import "PathsViewController.h"
#import "SWRevealViewController.h" //#import "SWRevealViewController.h"
#import "EmulatorViewController.h" #import "EmulatorViewController.h"
#import "DiskViewCell.h" #import "DiskViewCell.h"
@ -26,17 +26,22 @@
return self; return self;
} }
- (NSURL *)documents
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"Paths"; self.title = @"Paths";
// Set the side bar button action. When it's tapped, it'll show up the sidebar. // Set the side bar button action. When it's tapped, it'll show up the sidebar.
_sidebarButton.target = self.revealViewController; // _sidebarButton.target = self.revealViewController;
_sidebarButton.action = @selector(revealToggle:); // _sidebarButton.action = @selector(revealToggle:);
// Set the gesture // Set the gesture
[self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer]; // [self.view addGestureRecognizer:self.revealViewController.panGestureRecognizer];
// Uncomment the following line to preserve selection between presentations. // Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO; // self.clearsSelectionOnViewWillAppear = NO;
@ -44,14 +49,9 @@
// self.navigationItem.rightBarButtonItem = self.editButtonItem; // self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.diskImages = [[NSMutableArray alloc] init]; self.diskImages = [[NSMutableArray alloc] init];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:[self documents].path error:NULL];
NSString *documents = [paths objectAtIndex:0]; NSPredicate *diskPredicate = [NSPredicate predicateWithFormat:@"self ENDSWITH '.chd' || self ENDSWITH '.gdi' || self ENDSWITH '.cdi' || self ENDSWITH '.CHD' || self ENDSWITH '.GDI' || self ENDSWITH '.CDI'"];
NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documents error:NULL]; self.diskImages = [NSMutableArray arrayWithArray:[files filteredArrayUsingPredicate:diskPredicate]];
NSArray *filters = @[[NSPredicate predicateWithFormat:@"self ENDSWITH '.chd'"],
[NSPredicate predicateWithFormat:@"self ENDSWITH '.gdi'"],
[NSPredicate predicateWithFormat:@"self ENDSWITH '.cdi'"]];
NSPredicate *compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:filters];
self.diskImages = [NSMutableArray arrayWithArray:[files filteredArrayUsingPredicate:compoundPredicate]];
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning