From 458492f61114f8a8227774442f8af0e7a7f7a388 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sat, 22 Aug 2015 14:22:04 -0400 Subject: [PATCH] Add custom cells to support disk image --- .../emulator-ios/emulator/DiskViewCell.h | 8 ++++++ .../emulator-ios/emulator/DiskViewCell.m | 26 +++++++++++++++++++ .../emulator/MainStoryboard.storyboard | 19 +++++++++----- .../emulator/PathsViewController.m | 13 +++------- .../reicast-ios.xcodeproj/project.pbxproj | 7 +++++ 5 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 shell/apple/emulator-ios/emulator/DiskViewCell.h create mode 100644 shell/apple/emulator-ios/emulator/DiskViewCell.m diff --git a/shell/apple/emulator-ios/emulator/DiskViewCell.h b/shell/apple/emulator-ios/emulator/DiskViewCell.h new file mode 100644 index 000000000..208041a80 --- /dev/null +++ b/shell/apple/emulator-ios/emulator/DiskViewCell.h @@ -0,0 +1,8 @@ +#import + +@interface DiskViewCell : UITableViewCell + +@property (nonatomic, retain) IBOutlet UIImageView *diskImage; +@property (nonatomic, retain) IBOutlet UILabel *nameLabel; + +@end diff --git a/shell/apple/emulator-ios/emulator/DiskViewCell.m b/shell/apple/emulator-ios/emulator/DiskViewCell.m new file mode 100644 index 000000000..c199b6ac1 --- /dev/null +++ b/shell/apple/emulator-ios/emulator/DiskViewCell.m @@ -0,0 +1,26 @@ +#import "DiskViewCell.h" + +@implementation DiskViewCell + +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier +{ + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + // Initialization code + } + return self; +} + +- (void)awakeFromNib +{ + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated +{ + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/shell/apple/emulator-ios/emulator/MainStoryboard.storyboard b/shell/apple/emulator-ios/emulator/MainStoryboard.storyboard index 347cc5f9e..9b6a65e22 100644 --- a/shell/apple/emulator-ios/emulator/MainStoryboard.storyboard +++ b/shell/apple/emulator-ios/emulator/MainStoryboard.storyboard @@ -13,22 +13,29 @@ - - + + - + - + + diff --git a/shell/apple/emulator-ios/emulator/PathsViewController.m b/shell/apple/emulator-ios/emulator/PathsViewController.m index a9e624cf9..0442fe4b4 100644 --- a/shell/apple/emulator-ios/emulator/PathsViewController.m +++ b/shell/apple/emulator-ios/emulator/PathsViewController.m @@ -9,6 +9,7 @@ #import "PathsViewController.h" #import "SWRevealViewController.h" #import "EmulatorViewController.h" +#import "DiskViewCell.h" @interface PathsViewController () @@ -77,7 +78,7 @@ } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 160; + return 80; // Assign the specific cell height to prevent issues with custom size } @@ -85,16 +86,10 @@ { static NSString *CellIdentifier = @"Cell"; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; - if(cell == nil) - { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier]; - } - - assert(indexPath.row < [self.diskImages count]); + DiskViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; NSString* imagePath = [self.diskImages objectAtIndex: indexPath.row]; - cell.textLabel.text = [imagePath lastPathComponent]; + cell.nameLabel.text = [imagePath lastPathComponent]; return cell; } diff --git a/shell/apple/emulator-ios/reicast-ios.xcodeproj/project.pbxproj b/shell/apple/emulator-ios/reicast-ios.xcodeproj/project.pbxproj index 0e9dbc440..d42ca6155 100644 --- a/shell/apple/emulator-ios/reicast-ios.xcodeproj/project.pbxproj +++ b/shell/apple/emulator-ios/reicast-ios.xcodeproj/project.pbxproj @@ -52,6 +52,7 @@ 877652C61B6157BD00437F10 /* audiostream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 877652BF1B6157BD00437F10 /* audiostream.cpp */; }; 877652C91B6157FC00437F10 /* ngen_arm.S in Sources */ = {isa = PBXBuildFile; fileRef = 877652C71B6157FC00437F10 /* ngen_arm.S */; }; 877652CA1B6157FC00437F10 /* rec_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 877652C81B6157FC00437F10 /* rec_arm.cpp */; }; + 8794D9C31B88F3D600B1B3A3 /* DiskViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8794D9C21B88F3D600B1B3A3 /* DiskViewCell.m */; }; 87C208D71B7A4BFA00638BDD /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C208C61B7A4BFA00638BDD /* AboutViewController.m */; }; 87C208D81B7A4BFA00638BDD /* BrowserTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C208C81B7A4BFA00638BDD /* BrowserTableViewController.m */; }; 87C208D91B7A4BFA00638BDD /* CloudVMUViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C208CA1B7A4BFA00638BDD /* CloudVMUViewController.m */; }; @@ -323,6 +324,9 @@ 877652C11B6157BD00437F10 /* oslib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = oslib.h; sourceTree = ""; }; 877652C71B6157FC00437F10 /* ngen_arm.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ngen_arm.S; sourceTree = ""; }; 877652C81B6157FC00437F10 /* rec_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rec_arm.cpp; sourceTree = ""; }; + 877652CC1B615AE800437F10 /* fp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fp.h; sourceTree = ""; }; + 8794D9C11B88F3D600B1B3A3 /* DiskViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DiskViewCell.h; path = emulator/DiskViewCell.h; sourceTree = ""; }; + 8794D9C21B88F3D600B1B3A3 /* DiskViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DiskViewCell.m; path = emulator/DiskViewCell.m; sourceTree = ""; }; 87C208C51B7A4BFA00638BDD /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AboutViewController.h; path = emulator/AboutViewController.h; sourceTree = ""; }; 87C208C61B7A4BFA00638BDD /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AboutViewController.m; path = emulator/AboutViewController.m; sourceTree = ""; }; 87C208C71B7A4BFA00638BDD /* BrowserTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrowserTableViewController.h; path = emulator/BrowserTableViewController.h; sourceTree = ""; }; @@ -839,6 +843,8 @@ 9C7A393618C805F70070BB5F /* View Controller Subclasses */ = { isa = PBXGroup; children = ( + 8794D9C11B88F3D600B1B3A3 /* DiskViewCell.h */, + 8794D9C21B88F3D600B1B3A3 /* DiskViewCell.m */, 872EF6FF1B852EB200A0F617 /* VirtualViewController.h */, 872EF7001B852EB200A0F617 /* VirtualViewController.m */, 872EF7011B852EB200A0F617 /* VirtualViewController.xib */, @@ -1621,6 +1627,7 @@ 9C7A3B2318C806E00070BB5F /* sh4_opcodes.cpp in Sources */, 84967C951B8F492C005F1140 /* pngmem.c in Sources */, 9C7A3ADA18C806E00070BB5F /* zip_name_locate.c in Sources */, + 8794D9C31B88F3D600B1B3A3 /* DiskViewCell.m in Sources */, 9C7A3B1B18C806E00070BB5F /* ta_ctx.cpp in Sources */, 9C7A3AE018C806E00070BB5F /* zip_set_archive_flag.c in Sources */, 9C7A3B3518C806E00070BB5F /* cdi.cpp in Sources */,