From 2e7bea50b40ae7bed7b1231ddd3c72fa1ba68b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 17:23:47 +0200 Subject: [PATCH 01/14] 1000 instead of 10 items in example app --- Classes/AppDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/AppDelegate.m b/Classes/AppDelegate.m index 1efee47..f272aa5 100644 --- a/Classes/AppDelegate.m +++ b/Classes/AppDelegate.m @@ -14,7 +14,7 @@ #pragma mark Constants #define LISTVIEW_CELL_IDENTIFIER @"MyListViewCell" -#define NUM_EXAMPLE_ITEMS 10 +#define NUM_EXAMPLE_ITEMS 1000 @implementation AppDelegate From fff06d9b6c73d6d508a712ad9ab8ead21ed823a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 17:28:56 +0200 Subject: [PATCH 02/14] Add #pragma unused everywhere --- Classes/AppDelegate.m | 10 ++++++++++ Classes/MyListViewCell.m | 1 + Classes/PXListView+UserInteraction.m | 2 ++ Classes/PXListView.m | 5 +++++ Classes/PXListViewCell.m | 1 + 5 files changed, 19 insertions(+) diff --git a/Classes/AppDelegate.m b/Classes/AppDelegate.m index f272aa5..c8fbdf0 100644 --- a/Classes/AppDelegate.m +++ b/Classes/AppDelegate.m @@ -74,11 +74,14 @@ - (PXListViewCell*)listView:(PXListView*)aListView cellForRow:(NSUInteger)row - (CGFloat)listView:(PXListView*)aListView heightOfRow:(NSUInteger)row { +#pragma unused(aListView) +#pragma unused(row) return 50; } - (void)listViewSelectionDidChange:(NSNotification*)aNotification { +#pragma unused(aNotification) NSLog(@"Selection changed"); } @@ -86,6 +89,8 @@ - (void)listViewSelectionDidChange:(NSNotification*)aNotification // The following are only needed for drag'n drop: - (BOOL)listView:(PXListView*)aListView writeRowsWithIndexes:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard*)dragPasteboard { +#pragma unused(aListView) +#pragma unused(rowIndexes) // +++ Actually drag the items, not just dummy data. [dragPasteboard declareTypes: [NSArray arrayWithObjects: NSStringPboardType, nil] owner: self]; [dragPasteboard setString: @"Just Testing" forType: NSStringPboardType]; @@ -96,11 +101,16 @@ - (BOOL)listView:(PXListView*)aListView writeRowsWithIndexes:(NSIndexSet*)rowInd - (NSDragOperation)listView:(PXListView*)aListView validateDrop:(id )info proposedRow:(NSUInteger)row proposedDropHighlight:(PXListViewDropHighlight)dropHighlight; { +#pragma unused(aListView) +#pragma unused(dropHighlight) +#pragma unused(info) +#pragma unused(row) return NSDragOperationCopy; } - (IBAction) reloadTable:(id)sender { +#pragma unused(sender) [listView reloadData]; } diff --git a/Classes/MyListViewCell.m b/Classes/MyListViewCell.m index a9dbbf4..5a46e48 100644 --- a/Classes/MyListViewCell.m +++ b/Classes/MyListViewCell.m @@ -47,6 +47,7 @@ - (void)prepareForReuse - (void)drawRect:(NSRect)dirtyRect { +#pragma unused(dirtyRect) if([self isSelected]) { [[NSColor selectedControlColor] set]; } diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index c034727..a230c52 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -112,6 +112,7 @@ - (void)keyDown:(NSEvent *)theEvent - (void)moveUp:(id)sender { +#pragma unused(sender) if([_selectedRows count]>0) { NSUInteger firstIndex = [_selectedRows firstIndex]; @@ -126,6 +127,7 @@ - (void)moveUp:(id)sender - (void)moveDown:(id)sender { +#pragma unused(sender) if([_selectedRows count]>0) { NSUInteger lastIndex = [_selectedRows lastIndex]; diff --git a/Classes/PXListView.m b/Classes/PXListView.m index e7cb1a0..ce2b05f 100644 --- a/Classes/PXListView.m +++ b/Classes/PXListView.m @@ -108,6 +108,7 @@ - (void)setDelegate:(id)delegate -(void)reloadRowAtIndex:(NSInteger)inIndex; { +#pragma unused(inIndex) [self cacheCellLayout]; [self layoutCells]; //[self layoutCellsForResizeEvent]; @@ -350,6 +351,7 @@ - (void)updateCells - (void)selectAll:(id)sender { +#pragma unused(sender) if(_allowsMultipleSelection) { [self setSelectedRows:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, _numberOfRows)]]; } @@ -357,6 +359,7 @@ - (void)selectAll:(id)sender - (void)deselectAll:(id)sender { +#pragma unused(sender) [self setSelectedRows:[NSIndexSet indexSet]]; } @@ -552,6 +555,7 @@ - (void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize - (void)contentViewBoundsDidChange:(NSNotification *)notification { +#pragma unused(notification) [self updateCells]; } @@ -657,6 +661,7 @@ -(void)viewDidEndLiveResize -(void)windowSizing:(NSNotification *)inNot { +#pragma unused(inNot) [self layoutCellsForResizeEvent]; } diff --git a/Classes/PXListViewCell.m b/Classes/PXListViewCell.m index 736f665..2ef474c 100644 --- a/Classes/PXListViewCell.m +++ b/Classes/PXListViewCell.m @@ -108,6 +108,7 @@ - (void)setDropHighlight:(PXListViewDropHighlight)inState - (void)drawRect:(NSRect)dirtyRect { +#pragma unused(dirtyRect) if(_dropHighlight == PXListViewDropAbove) { [[NSColor alternateSelectedControlColor] set]; From bf8fc7dce85dbe5802242ce1a5c0c5c96bb944ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 17:31:36 +0200 Subject: [PATCH 03/14] Fix warning about undeclared selector --- Classes/PXListView+Private.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/PXListView+Private.h b/Classes/PXListView+Private.h index 65d2e96..e6cda3c 100644 --- a/Classes/PXListView+Private.h +++ b/Classes/PXListView+Private.h @@ -40,4 +40,6 @@ typedef NSInteger PXIsDragStartResult; - (void)contentViewBoundsDidChange:(NSNotification*)notification; -(void)layoutCellsForResizeEvent; +- (void)windowSizing:(NSNotification *)inNot; + @end From c7e478b95df63ced628c47dcbe5ccb7123d4cb9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 17:34:06 +0200 Subject: [PATCH 04/14] Switch to LLVM and fix warnings about atomic property that isn't --- Classes/PXListDocumentView.h | 2 +- Classes/PXListViewCell.h | 2 +- PXListView.xcodeproj/project.pbxproj | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/PXListDocumentView.h b/Classes/PXListDocumentView.h index 4b820f5..a47d379 100644 --- a/Classes/PXListDocumentView.h +++ b/Classes/PXListDocumentView.h @@ -19,7 +19,7 @@ } @property (assign) PXListView *listView; -@property (assign) PXListViewDropHighlight dropHighlight; +@property (assign,nonatomic) PXListViewDropHighlight dropHighlight; -(void) setDropHighlight: (PXListViewDropHighlight)inState; diff --git a/Classes/PXListViewCell.h b/Classes/PXListViewCell.h index 44b3835..9c676d5 100644 --- a/Classes/PXListViewCell.h +++ b/Classes/PXListViewCell.h @@ -27,7 +27,7 @@ @property (readonly) NSUInteger row; @property (readonly,getter=isSelected) BOOL selected; -@property (assign) PXListViewDropHighlight dropHighlight; +@property (assign,nonatomic) PXListViewDropHighlight dropHighlight; + (id)cellLoadedFromNibNamed:(NSString*)nibName reusableIdentifier:(NSString*)identifier; + (id)cellLoadedFromNibNamed:(NSString*)nibName bundle:(NSBundle*)bundle reusableIdentifier:(NSString*)identifier; diff --git a/PXListView.xcodeproj/project.pbxproj b/PXListView.xcodeproj/project.pbxproj index 112dd9e..301d4c5 100644 --- a/PXListView.xcodeproj/project.pbxproj +++ b/PXListView.xcodeproj/project.pbxproj @@ -284,6 +284,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = PXListView_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; @@ -316,6 +317,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = PXListView_Prefix.pch; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; From 70deaabba1d8651e7dd99e50242a222d76a0087f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 19:10:37 +0200 Subject: [PATCH 05/14] Fix scrollRowToVisible: behaviour. Fixes #14 --- Classes/PXListView+Private.h | 7 +++++++ Classes/PXListView+UserInteraction.m | 7 ------- Classes/PXListView.h | 1 - Classes/PXListView.m | 31 +++++----------------------- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/Classes/PXListView+Private.h b/Classes/PXListView+Private.h index e6cda3c..ee69f99 100644 --- a/Classes/PXListView+Private.h +++ b/Classes/PXListView+Private.h @@ -6,6 +6,13 @@ // Copyright 2010 Alex Rozanski. http://perspx.com. All rights reserved. // +// Apple sadly doesn't provide CGFloat variants of these: +#if CGFLOAT_IS_DOUBLE +#define CGFLOATABS(n) fabs(n) +#else +#define CGFLOATABS(n) fabsf(n) +#endif + // This is a renamed copy of UKIsDragStart from : // Possible return values from UKIsDragStart: enum diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index a230c52..53bdf72 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -11,13 +11,6 @@ #import "PXListView+UserInteraction.h" #import "PXListView+Private.h" -// Apple sadly doesn't provide CGFloat variants of these: -#if CGFLOAT_IS_DOUBLE -#define CGFLOATABS(n) fabs(n) -#else -#define CGFLOATABS(n) fabsf(n) -#endif - // This is a renamed copy of UKIsDragStart from : static PXIsDragStartResult PXIsDragStart( NSEvent *startEvent, NSTimeInterval theTimeout ) { diff --git a/Classes/PXListView.h b/Classes/PXListView.h index db37ce6..a66d618 100644 --- a/Classes/PXListView.h +++ b/Classes/PXListView.h @@ -72,7 +72,6 @@ - (void)deselectRows; - (void)selectRowIndexes:(NSIndexSet*)rows byExtendingSelection:(BOOL)doExtend; -- (void)scrollToRow:(NSUInteger)row; - (void)scrollRowToVisible:(NSUInteger)row; @end diff --git a/Classes/PXListView.m b/Classes/PXListView.m index ce2b05f..d8f4df4 100644 --- a/Classes/PXListView.m +++ b/Classes/PXListView.m @@ -559,27 +559,6 @@ - (void)contentViewBoundsDidChange:(NSNotification *)notification [self updateCells]; } -- (void)scrollToRow:(NSUInteger)row -{ - if(row >= _numberOfRows) { - return; - } - - // Use minimal scroll necessary, so we don't force the selection to upper left of window: - NSRect visibleRect = [self documentVisibleRect]; - NSRect rowRect = [self rectOfRow:row]; - - NSPoint newScrollPoint = rowRect.origin; - - //Have we over-scrolled? - if(NSMaxY(rowRect) > NSMaxY(visibleRect)) { - newScrollPoint.y = _totalHeight - NSHeight(visibleRect); - } - - [[self contentView] scrollToPoint:newScrollPoint]; - [self reflectScrolledClipView:[self contentView]]; -} - - (void)scrollRowToVisible:(NSUInteger)row { if(row >= _numberOfRows) { @@ -596,11 +575,11 @@ - (void)scrollRowToVisible:(NSUInteger)row NSPoint newScrollPoint = rowRect.origin; - //Have we over-scrolled? - if(NSMaxY(rowRect) > NSMaxY(visibleRect)) { - newScrollPoint.y = _totalHeight - NSHeight(visibleRect); - } - + if(NSMaxY(visibleRect) > NSMaxY(rowRect)) + newScrollPoint.y = NSMinY(rowRect); + else + newScrollPoint.y = NSMinY(visibleRect) - (NSMaxY(visibleRect) - NSMinY(rowRect)) + NSHeight(rowRect); + [[self contentView] scrollToPoint:newScrollPoint]; [self reflectScrolledClipView:[self contentView]]; } From 44c27f36e58d67e2f8d5f37eb01be566e603e714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 19:18:06 +0200 Subject: [PATCH 06/14] Move from CGPoint to NSPoint to keep LLVM from complaining --- Classes/PXListView+UserInteraction.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index 53bdf72..5865700 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -266,7 +266,7 @@ -(NSImage*) dragImageForRowsWithIndexes: (NSIndexSet *)dragRows event: (NSEvent* NSPoint localMouse = [self convertPoint: NSZeroPoint fromView: clickedCell]; if ([clickedCell isFlipped]) { - localMouse = [self convertPoint:CGPointMake(0, NSHeight(clickedCell.frame) * 2) fromView:clickedCell]; + localMouse = [self convertPoint:NSMakePoint(0, NSHeight(clickedCell.frame) * 2) fromView:clickedCell]; } localMouse.y += [self documentVisibleRect].origin.y; From 7696a0ae79b46e1e6ab5391d8f382f901cf6564c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 19:19:12 +0200 Subject: [PATCH 07/14] Add .framework target --- PXListView.xcodeproj/project.pbxproj | 153 +++++++++++++++++++++++++- PXListView/PXListView-Info.plist | 30 +++++ PXListView/PXListView-Prefix.pch | 7 ++ PXListView/en.lproj/InfoPlist.strings | 2 + 4 files changed, 187 insertions(+), 5 deletions(-) create mode 100644 PXListView/PXListView-Info.plist create mode 100644 PXListView/PXListView-Prefix.pch create mode 100644 PXListView/en.lproj/InfoPlist.strings diff --git a/PXListView.xcodeproj/project.pbxproj b/PXListView.xcodeproj/project.pbxproj index 301d4c5..bd1e0aa 100644 --- a/PXListView.xcodeproj/project.pbxproj +++ b/PXListView.xcodeproj/project.pbxproj @@ -9,6 +9,12 @@ /* Begin PBXBuildFile section */ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + C53B006E138D6FE90026A20F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C53B006D138D6FE90026A20F /* Cocoa.framework */; }; + C53B0074138D6FEA0026A20F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C53B0072138D6FEA0026A20F /* InfoPlist.strings */; }; + C53B007A138D700B0026A20F /* PXListView.m in Sources */ = {isa = PBXBuildFile; fileRef = D27858D111B1B5EA00F1CF30 /* PXListView.m */; }; + C53B007E138D700B0026A20F /* PXListView+UserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */; }; + C53B0081138D700B0026A20F /* PXListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D27858D411B1B5FC00F1CF30 /* PXListViewCell.m */; }; + C53B0084138D700B0026A20F /* PXListDocumentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D278592311B1BA6C00F1CF30 /* PXListDocumentView.m */; }; D25DDA7F133F58A20086783B /* PXListView+UserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */; }; D26669CB11B1B2F1007597F1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D26669CA11B1B2F1007597F1 /* AppDelegate.m */; }; D26669D211B1B302007597F1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D26669CE11B1B302007597F1 /* InfoPlist.strings */; }; @@ -30,6 +36,11 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 55B9AC9E11EA384C00416532 /* PXListViewDropHighlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PXListViewDropHighlight.h; path = Classes/PXListViewDropHighlight.h; sourceTree = ""; }; 8D1107320486CEB800E47090 /* PXListView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PXListView.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C53B006C138D6FE90026A20F /* PXListView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PXListView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C53B006D138D6FE90026A20F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + C53B0071138D6FEA0026A20F /* PXListView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PXListView-Info.plist"; sourceTree = ""; }; + C53B0073138D6FEA0026A20F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C53B0075138D6FEA0026A20F /* PXListView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PXListView-Prefix.pch"; sourceTree = ""; }; D25DDA7D133F58A10086783B /* PXListView+UserInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "PXListView+UserInteraction.h"; path = "Classes/PXListView+UserInteraction.h"; sourceTree = ""; }; D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "PXListView+UserInteraction.m"; path = "Classes/PXListView+UserInteraction.m"; sourceTree = ""; }; D26669C911B1B2F1007597F1 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Classes/AppDelegate.h; sourceTree = ""; }; @@ -61,6 +72,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C53B0068138D6FE90026A20F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C53B006E138D6FE90026A20F /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -86,6 +105,7 @@ isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* PXListView.app */, + C53B006C138D6FE90026A20F /* PXListView.framework */, ); name = Products; sourceTree = ""; @@ -117,11 +137,23 @@ isa = PBXGroup; children = ( 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + C53B006D138D6FE90026A20F /* Cocoa.framework */, 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; + C53B0070138D6FEA0026A20F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + C53B0071138D6FEA0026A20F /* PXListView-Info.plist */, + C53B0072138D6FEA0026A20F /* InfoPlist.strings */, + C53B0075138D6FEA0026A20F /* PXListView-Prefix.pch */, + ); + name = "Supporting Files"; + path = PXListView; + sourceTree = ""; + }; D25DDA7A133F568F0086783B /* PXListView */ = { isa = PBXGroup; children = ( @@ -133,6 +165,7 @@ D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */, D279A68911B4ECAB00771B2A /* Cells */, D278592911B1BA7900F1CF30 /* Misc */, + C53B0070138D6FEA0026A20F /* Supporting Files */, ); name = PXListView; sourceTree = ""; @@ -181,10 +214,20 @@ }; /* End PBXGroup section */ +/* Begin PBXHeadersBuildPhase section */ + C53B0069138D6FE90026A20F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + /* Begin PBXNativeTarget section */ - 8D1107260486CEB800E47090 /* PXListView */ = { + 8D1107260486CEB800E47090 /* Demo App */ = { isa = PBXNativeTarget; - buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "PXListView" */; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Demo App" */; buildPhases = ( 8D1107290486CEB800E47090 /* Resources */, 8D11072C0486CEB800E47090 /* Sources */, @@ -194,12 +237,30 @@ ); dependencies = ( ); - name = PXListView; + name = "Demo App"; productInstallPath = "$(HOME)/Applications"; productName = PXListView; productReference = 8D1107320486CEB800E47090 /* PXListView.app */; productType = "com.apple.product-type.application"; }; + C53B006B138D6FE90026A20F /* PXListView */ = { + isa = PBXNativeTarget; + buildConfigurationList = C53B0076138D6FEA0026A20F /* Build configuration list for PBXNativeTarget "PXListView" */; + buildPhases = ( + C53B0067138D6FE90026A20F /* Sources */, + C53B0068138D6FE90026A20F /* Frameworks */, + C53B0069138D6FE90026A20F /* Headers */, + C53B006A138D6FE90026A20F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = PXListView; + productName = PXListView; + productReference = C53B006C138D6FE90026A20F /* PXListView.framework */; + productType = "com.apple.product-type.framework"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -216,7 +277,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 8D1107260486CEB800E47090 /* PXListView */, + 8D1107260486CEB800E47090 /* Demo App */, + C53B006B138D6FE90026A20F /* PXListView */, ); }; /* End PBXProject section */ @@ -233,6 +295,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C53B006A138D6FE90026A20F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C53B0074138D6FEA0026A20F /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -250,9 +320,28 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C53B0067138D6FE90026A20F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C53B007A138D700B0026A20F /* PXListView.m in Sources */, + C53B007E138D700B0026A20F /* PXListView+UserInteraction.m in Sources */, + C53B0081138D700B0026A20F /* PXListViewCell.m in Sources */, + C53B0084138D700B0026A20F /* PXListDocumentView.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ + C53B0072138D6FEA0026A20F /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + C53B0073138D6FEA0026A20F /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; D26669CE11B1B302007597F1 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -367,10 +456,56 @@ }; name = Release; }; + C53B0077138D6FEA0026A20F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PXListView/PXListView-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "PXListView/PXListView-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + WRAPPER_EXTENSION = framework; + }; + name = Debug; + }; + C53B0078138D6FEA0026A20F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "PXListView/PXListView-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + INFOPLIST_FILE = "PXListView/PXListView-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.6; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "PXListView" */ = { + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Demo App" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4B08A954540054247B /* Debug */, @@ -388,6 +523,14 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + C53B0076138D6FEA0026A20F /* Build configuration list for PBXNativeTarget "PXListView" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C53B0077138D6FEA0026A20F /* Debug */, + C53B0078138D6FEA0026A20F /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; diff --git a/PXListView/PXListView-Info.plist b/PXListView/PXListView-Info.plist new file mode 100644 index 0000000..a75c8be --- /dev/null +++ b/PXListView/PXListView-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.perspx.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSHumanReadableCopyright + Copyright © 2011 __MyCompanyName__. All rights reserved. + NSPrincipalClass + + + diff --git a/PXListView/PXListView-Prefix.pch b/PXListView/PXListView-Prefix.pch new file mode 100644 index 0000000..24e1f1d --- /dev/null +++ b/PXListView/PXListView-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'PXListView' target in the 'PXListView' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/PXListView/en.lproj/InfoPlist.strings b/PXListView/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/PXListView/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + From f15655bb6cc42d7f6f6db53d98a8fcf59fb875ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Wed, 25 May 2011 21:29:19 +0200 Subject: [PATCH 08/14] Fix .framework build so that build product includes Headers --- PXListView.xcodeproj/project.pbxproj | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/PXListView.xcodeproj/project.pbxproj b/PXListView.xcodeproj/project.pbxproj index bd1e0aa..10465fa 100644 --- a/PXListView.xcodeproj/project.pbxproj +++ b/PXListView.xcodeproj/project.pbxproj @@ -10,11 +10,18 @@ 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; C53B006E138D6FE90026A20F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C53B006D138D6FE90026A20F /* Cocoa.framework */; }; - C53B0074138D6FEA0026A20F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C53B0072138D6FEA0026A20F /* InfoPlist.strings */; }; C53B007A138D700B0026A20F /* PXListView.m in Sources */ = {isa = PBXBuildFile; fileRef = D27858D111B1B5EA00F1CF30 /* PXListView.m */; }; C53B007E138D700B0026A20F /* PXListView+UserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */; }; C53B0081138D700B0026A20F /* PXListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D27858D411B1B5FC00F1CF30 /* PXListViewCell.m */; }; C53B0084138D700B0026A20F /* PXListDocumentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D278592311B1BA6C00F1CF30 /* PXListDocumentView.m */; }; + C53B00AB138D8D860026A20F /* PXListView.h in Headers */ = {isa = PBXBuildFile; fileRef = D27858D011B1B5EA00F1CF30 /* PXListView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C53B00AC138D8D860026A20F /* PXListView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D279A64311B4E95600771B2A /* PXListView+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C53B00AD138D8D860026A20F /* PXListViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = D27858D711B1B6D400F1CF30 /* PXListViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C53B00AE138D8D860026A20F /* PXListView+UserInteraction.h in Headers */ = {isa = PBXBuildFile; fileRef = D25DDA7D133F58A10086783B /* PXListView+UserInteraction.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C53B00AF138D8D860026A20F /* PXListViewDropHighlight.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B9AC9E11EA384C00416532 /* PXListViewDropHighlight.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C53B00B0138D8D860026A20F /* PXListViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = D27858D311B1B5FC00F1CF30 /* PXListViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C53B00B1138D8D860026A20F /* PXListViewCell+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D279A6DD11B4EFCD00771B2A /* PXListViewCell+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C53B00B2138D8D860026A20F /* PXListDocumentView.h in Headers */ = {isa = PBXBuildFile; fileRef = D278592211B1BA6C00F1CF30 /* PXListDocumentView.h */; settings = {ATTRIBUTES = (Public, ); }; }; D25DDA7F133F58A20086783B /* PXListView+UserInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25DDA7E133F58A10086783B /* PXListView+UserInteraction.m */; }; D26669CB11B1B2F1007597F1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D26669CA11B1B2F1007597F1 /* AppDelegate.m */; }; D26669D211B1B302007597F1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D26669CE11B1B302007597F1 /* InfoPlist.strings */; }; @@ -219,6 +226,14 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + C53B00AB138D8D860026A20F /* PXListView.h in Headers */, + C53B00AD138D8D860026A20F /* PXListViewDelegate.h in Headers */, + C53B00AE138D8D860026A20F /* PXListView+UserInteraction.h in Headers */, + C53B00AF138D8D860026A20F /* PXListViewDropHighlight.h in Headers */, + C53B00B0138D8D860026A20F /* PXListViewCell.h in Headers */, + C53B00B2138D8D860026A20F /* PXListDocumentView.h in Headers */, + C53B00AC138D8D860026A20F /* PXListView+Private.h in Headers */, + C53B00B1138D8D860026A20F /* PXListViewCell+Private.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -299,7 +314,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - C53B0074138D6FEA0026A20F /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -530,6 +544,7 @@ C53B0078138D6FEA0026A20F /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; From 8baa7c620081aada9be72c706c5b49c61954a132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Thu, 26 May 2011 02:29:00 +0200 Subject: [PATCH 09/14] theEvent isn't really unused --- Classes/PXListView+UserInteraction.m | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index 5865700..fed0cc9 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -212,7 +212,6 @@ - (void)handleMouseDown:(NSEvent*)theEvent inCell:(PXListViewCell*)theCell // Ce - (void)handleMouseDownOutsideCells: (NSEvent*)theEvent { -#pragma unused(theEvent) //[[self window] makeFirstResponder: self]; // if( _allowsEmptySelection ) From 5a7e6657863a1fdf5655bac14d90b8a4c6cff74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Thu, 26 May 2011 02:32:49 +0200 Subject: [PATCH 10/14] Add dragSupported property to disable drag&drop behaviour, defaults to YES --- Classes/PXListView+UserInteraction.m | 3 +++ Classes/PXListView.h | 3 +++ Classes/PXListView.m | 3 +++ 3 files changed, 9 insertions(+) diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index fed0cc9..390d993 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -237,6 +237,9 @@ - (void)handleMouseDownOutsideCells: (NSEvent*)theEvent - (BOOL)attemptDragWithMouseDown:(NSEvent*)theEvent inCell:(PXListViewCell*)theCell { + if(!_dragSupported) + return NO; + PXIsDragStartResult dragResult = PXIsDragStart( theEvent, 0.0 ); if( dragResult != PXIsDragStartMouseReleased /*&& (_verticalMotionCanBeginDrag || dragResult != PXIsDragStartMouseMovedVertically)*/ ) // Was a drag, not a click? Cool! { diff --git a/Classes/PXListView.h b/Classes/PXListView.h index a66d618..1c9755e 100644 --- a/Classes/PXListView.h +++ b/Classes/PXListView.h @@ -38,6 +38,7 @@ BOOL _allowsMultipleSelection; NSInteger _lastSelectedRow; + BOOL _dragSupported; BOOL _verticalMotionCanBeginDrag; BOOL _usesLiveResize; @@ -54,7 +55,9 @@ @property (nonatomic, assign) BOOL allowsEmptySelection; @property (nonatomic, assign) BOOL allowsMultipleSelection; + @property (nonatomic, assign) BOOL verticalMotionCanBeginDrag; +@property (nonatomic, assign) BOOL dragSupported; @property (nonatomic, assign) CGFloat cellSpacing; @property (nonatomic, assign) BOOL usesLiveResize; diff --git a/Classes/PXListView.m b/Classes/PXListView.m index d8f4df4..558d39b 100644 --- a/Classes/PXListView.m +++ b/Classes/PXListView.m @@ -21,6 +21,7 @@ @implementation PXListView @synthesize cellSpacing = _cellSpacing; @synthesize allowsMultipleSelection = _allowsMultipleSelection; @synthesize allowsEmptySelection = _allowsEmptySelection; +@synthesize dragSupported = _dragSupported; @synthesize verticalMotionCanBeginDrag = _verticalMotionCanBeginDrag; @synthesize usesLiveResize = _usesLiveResize; @@ -36,6 +37,7 @@ - (id)initWithFrame:(NSRect)theFrame _selectedRows = [[NSMutableIndexSet alloc] init]; _allowsEmptySelection = YES; _usesLiveResize = YES; + _dragSupported = YES; } return self; @@ -50,6 +52,7 @@ - (id)initWithCoder:(NSCoder*)decoder _selectedRows = [[NSMutableIndexSet alloc] init]; _allowsEmptySelection = YES; _usesLiveResize = YES; + _dragSupported = YES; } return self; From fba5266d524e22bd3df4a011dd18adf972e3e03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Thu, 26 May 2011 02:37:59 +0200 Subject: [PATCH 11/14] Call [self initWithFrame:] instead of super since we have overwritten that --- Classes/PXListViewCell.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/PXListViewCell.m b/Classes/PXListViewCell.m index 2ef474c..5fcf04f 100644 --- a/Classes/PXListViewCell.m +++ b/Classes/PXListViewCell.m @@ -55,7 +55,7 @@ + (id)cellLoadedFromNibNamed:(NSString*)nibName bundle:(NSBundle*)bundle reusabl - (id)initWithReusableIdentifier:(NSString*)identifier { - if((self = [super initWithFrame: NSZeroRect])) + if((self = [self initWithFrame: NSZeroRect])) { _reusableIdentifier = [identifier copy]; } @@ -66,7 +66,7 @@ - (id)initWithReusableIdentifier:(NSString*)identifier - (id)initWithCoder:(NSCoder *)aDecoder { - if((self = [super initWithCoder: aDecoder])) + if((self = [self initWithCoder: aDecoder])) { _reusableIdentifier = NSStringFromClass([self class]); } From 07e480c7e5d87b683c9c868ec46e7e3fd1ce4cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Tue, 7 Jun 2011 23:44:06 +0200 Subject: [PATCH 12/14] Drain pool so it also works with GC --- Classes/PXListView+UserInteraction.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/PXListView+UserInteraction.m b/Classes/PXListView+UserInteraction.m index 390d993..fc4fe63 100644 --- a/Classes/PXListView+UserInteraction.m +++ b/Classes/PXListView+UserInteraction.m @@ -24,7 +24,7 @@ static PXIsDragStartResult PXIsDragStart( NSEvent *startEvent, NSTimeInterval th NSAutoreleasePool *pool = nil; while( ([expireTime timeIntervalSinceReferenceDate] -[NSDate timeIntervalSinceReferenceDate]) > 0 ) { - [pool release]; + [pool drain]; pool = [[NSAutoreleasePool alloc] init]; NSEvent* currEvent = [NSApp nextEventMatchingMask: NSLeftMouseUpMask | NSRightMouseUpMask | NSOtherMouseUpMask @@ -38,7 +38,7 @@ static PXIsDragStartResult PXIsDragStart( NSEvent *startEvent, NSTimeInterval th case NSRightMouseUp: case NSOtherMouseUp: { - [pool release]; + [pool drain]; return PXIsDragStartMouseReleased; // Mouse released within the wait time. break; } @@ -52,7 +52,7 @@ static PXIsDragStartResult PXIsDragStart( NSEvent *startEvent, NSTimeInterval th CGFloat yMouseMovement = CGFLOATABS(newPos.y -startPos.y); if( xMouseMovement > 2 or yMouseMovement > 2 ) { - [pool release]; + [pool drain]; return (xMouseMovement > yMouseMovement) ? PXIsDragStartMouseMovedHorizontally : PXIsDragStartMouseMovedVertically; // Mouse moved within the wait time, probably a drag! } break; @@ -62,7 +62,7 @@ static PXIsDragStartResult PXIsDragStart( NSEvent *startEvent, NSTimeInterval th } - [pool release]; + [pool drain]; return PXIsDragStartTimedOut; // If they held the mouse that long, they probably wanna drag. } From b6d2ea3b26871b504ef5d9b61aa9cb463055107c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Thu, 9 Jun 2011 22:03:04 +0200 Subject: [PATCH 13/14] Fix warnings in Build For Archiving --- Classes/PXListView.h | 4 +++- Classes/PXListView.m | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Classes/PXListView.h b/Classes/PXListView.h index 1c9755e..4cabbcc 100644 --- a/Classes/PXListView.h +++ b/Classes/PXListView.h @@ -10,7 +10,7 @@ #import "PXListViewDelegate.h" #import "PXListViewCell.h" - +#import "PXListDocumentView.h" #if DEBUG #define PXLog(...) NSLog(__VA_ARGS__) @@ -62,6 +62,8 @@ @property (nonatomic, assign) CGFloat cellSpacing; @property (nonatomic, assign) BOOL usesLiveResize; +- (PXListDocumentView *)documentView; + - (void)reloadData; -(void)reloadRowAtIndex:(NSInteger)inIndex; diff --git a/Classes/PXListView.m b/Classes/PXListView.m index 558d39b..5c4ad85 100644 --- a/Classes/PXListView.m +++ b/Classes/PXListView.m @@ -13,6 +13,8 @@ #import "PXListViewCell+Private.h" #import "PXListView+UserInteraction.h" +#import "PXListDocumentView.h" + NSString * const PXListViewSelectionDidChange = @"PXListViewSelectionDidChange"; @@ -25,6 +27,10 @@ @implementation PXListView @synthesize verticalMotionCanBeginDrag = _verticalMotionCanBeginDrag; @synthesize usesLiveResize = _usesLiveResize; +- (PXListDocumentView *)documentView { + return [super documentView]; +} + #pragma mark - #pragma mark Init/Dealloc @@ -508,7 +514,7 @@ - (void)cacheCellLayout - (void)layoutCells { //Set the frames of the cells - for(id cell in _visibleCells) + for(PXListViewCell *cell in _visibleCells) { NSInteger row = [cell row]; [cell setFrame:[self rectOfRow:row]]; From 72b351160c2bc79f2f2829728ce940a9c274d0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Schu=CC=88rrer?= Date: Tue, 14 Jun 2011 05:49:09 +0200 Subject: [PATCH 14/14] Fix strange crash bug --- Classes/PXListView.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/PXListView.m b/Classes/PXListView.m index 5c4ad85..08485e8 100644 --- a/Classes/PXListView.m +++ b/Classes/PXListView.m @@ -347,7 +347,9 @@ - (void)updateCells { for(NSUInteger i = NSMaxRange(_currentRange); i > NSMaxRange(visibleRange); i--) { - [self enqueueCell:[_visibleCells lastObject]]; + if([_visibleCells lastObject]) { + [self enqueueCell:[_visibleCells lastObject]]; + } } } }