Add custom cells to support disk image

This commit is contained in:
TwistedUmbrella 2015-08-22 14:22:04 -04:00
parent df707aa60e
commit 458492f611
5 changed files with 58 additions and 15 deletions

View File

@ -0,0 +1,8 @@
#import <UIKit/UIKit.h>
@interface DiskViewCell : UITableViewCell
@property (nonatomic, retain) IBOutlet UIImageView *diskImage;
@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@end

View File

@ -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

View File

@ -13,22 +13,29 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="jQL-xa-pqV" style="IBUITableViewCellStyleDefault" id="PlF-ZX-S1T">
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" rowHeight="80" id="PlF-ZX-S1T" customClass="DiskViewCell">
<rect key="frame" x="0.0" y="22" width="320" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PlF-ZX-S1T" id="65y-zb-4x3">
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="79.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jQL-xa-pqV">
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Epl-iu-f5s">
<rect key="frame" x="88" y="29" width="199" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="6Qh-mW-Z9j">
<rect key="frame" x="8" y="4" width="72" height="72"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="diskImage" destination="6Qh-mW-Z9j" id="kv2-En-yNt"/>
<outlet property="nameLabel" destination="Epl-iu-f5s" id="Tyn-LD-ioh"/>
<segue destination="WRM-pR-XCP" kind="push" identifier="emulatorView" id="xKH-h0-TDD"/>
</connections>
</tableViewCell>

View File

@ -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;
}

View File

@ -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 = "<group>"; };
877652C71B6157FC00437F10 /* ngen_arm.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = ngen_arm.S; sourceTree = "<group>"; };
877652C81B6157FC00437F10 /* rec_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = rec_arm.cpp; sourceTree = "<group>"; };
877652CC1B615AE800437F10 /* fp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fp.h; sourceTree = "<group>"; };
8794D9C11B88F3D600B1B3A3 /* DiskViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DiskViewCell.h; path = emulator/DiskViewCell.h; sourceTree = "<group>"; };
8794D9C21B88F3D600B1B3A3 /* DiskViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DiskViewCell.m; path = emulator/DiskViewCell.m; sourceTree = "<group>"; };
87C208C51B7A4BFA00638BDD /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AboutViewController.h; path = emulator/AboutViewController.h; sourceTree = "<group>"; };
87C208C61B7A4BFA00638BDD /* AboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AboutViewController.m; path = emulator/AboutViewController.m; sourceTree = "<group>"; };
87C208C71B7A4BFA00638BDD /* BrowserTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BrowserTableViewController.h; path = emulator/BrowserTableViewController.h; sourceTree = "<group>"; };
@ -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 */,