Remove UDTableView. fixes #591

This commit is contained in:
Blake Watters
2012-03-29 20:04:12 -04:00
parent 54d9ee7c52
commit f4f3f44e17
6 changed files with 0 additions and 375 deletions

View File

@@ -1,13 +0,0 @@
//
// RKTableView.h
// RestKit
//
// Created by Jeff Arena on 1/9/12.
// Copyright (c) 2012 RestKit. All rights reserved.
//
#import "UDTableView.h"
@interface RKTableView : UDTableView
@end

View File

@@ -1,13 +0,0 @@
//
// RKTableView.m
// RestKit
//
// Created by Jeff Arena on 1/9/12.
// Copyright (c) 2012 RestKit. All rights reserved.
//
#import "RKTableView.h"
@implementation RKTableView
@end

View File

@@ -471,16 +471,12 @@
251611321456F56C0060A5C5 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 251611311456F56C0060A5C5 /* MobileCoreServices.framework */; };
252EFAFA14D8EAEC004863C8 /* RKEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFAF914D8EAEC004863C8 /* RKEvent.m */; };
252EFAFB14D8EAEC004863C8 /* RKEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFAF914D8EAEC004863C8 /* RKEvent.m */; };
252EFB0214D98EB0004863C8 /* RKTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 252EFB0014D98EB0004863C8 /* RKTableView.h */; settings = {ATTRIBUTES = (Public, ); }; };
252EFB0414D98EB0004863C8 /* RKTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0114D98EB0004863C8 /* RKTableView.m */; };
252EFB0814D98F4D004863C8 /* RKSearchableManagedObjectTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0614D98F4D004863C8 /* RKSearchableManagedObjectTest.m */; };
252EFB0914D98F4D004863C8 /* RKSearchableManagedObjectTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0614D98F4D004863C8 /* RKSearchableManagedObjectTest.m */; };
252EFB0A14D98F4D004863C8 /* RKSearchWordObserverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0714D98F4D004863C8 /* RKSearchWordObserverTest.m */; };
252EFB0B14D98F4D004863C8 /* RKSearchWordObserverTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0714D98F4D004863C8 /* RKSearchWordObserverTest.m */; };
252EFB0D14D98F76004863C8 /* RKMutableBlockDictionaryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0C14D98F76004863C8 /* RKMutableBlockDictionaryTest.m */; };
252EFB0E14D98F76004863C8 /* RKMutableBlockDictionaryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB0C14D98F76004863C8 /* RKMutableBlockDictionaryTest.m */; };
252EFB1614D99222004863C8 /* UDTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 252EFB1414D99222004863C8 /* UDTableView.h */; settings = {ATTRIBUTES = (Public, ); }; };
252EFB1714D99222004863C8 /* UDTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB1514D99222004863C8 /* UDTableView.m */; };
252EFB1B14D9A7CB004863C8 /* NSBundle+RKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 252EFB1914D9A7CB004863C8 /* NSBundle+RKAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
252EFB1C14D9A7CB004863C8 /* NSBundle+RKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 252EFB1914D9A7CB004863C8 /* NSBundle+RKAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
252EFB1D14D9A7CB004863C8 /* NSBundle+RKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 252EFB1A14D9A7CB004863C8 /* NSBundle+RKAdditions.m */; };
@@ -1013,14 +1009,9 @@
252EFAF914D8EAEC004863C8 /* RKEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKEvent.m; sourceTree = "<group>"; };
252EFAFC14D8EB30004863C8 /* RKTestNotificationObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RKTestNotificationObserver.h; path = Testing/RKTestNotificationObserver.h; sourceTree = "<group>"; };
252EFAFD14D8EB30004863C8 /* RKTestNotificationObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RKTestNotificationObserver.m; path = Testing/RKTestNotificationObserver.m; sourceTree = "<group>"; };
252EFB0014D98EB0004863C8 /* RKTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKTableView.h; sourceTree = "<group>"; };
252EFB0114D98EB0004863C8 /* RKTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKTableView.m; sourceTree = "<group>"; };
252EFB0614D98F4D004863C8 /* RKSearchableManagedObjectTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSearchableManagedObjectTest.m; sourceTree = "<group>"; };
252EFB0714D98F4D004863C8 /* RKSearchWordObserverTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSearchWordObserverTest.m; sourceTree = "<group>"; };
252EFB0C14D98F76004863C8 /* RKMutableBlockDictionaryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKMutableBlockDictionaryTest.m; sourceTree = "<group>"; };
252EFB1314D99222004863C8 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
252EFB1414D99222004863C8 /* UDTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UDTableView.h; sourceTree = "<group>"; };
252EFB1514D99222004863C8 /* UDTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UDTableView.m; sourceTree = "<group>"; };
252EFB1914D9A7CB004863C8 /* NSBundle+RKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+RKAdditions.h"; sourceTree = "<group>"; };
252EFB1A14D9A7CB004863C8 /* NSBundle+RKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+RKAdditions.m"; sourceTree = "<group>"; };
252EFB2014D9B35D004863C8 /* RKTestFixture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RKTestFixture.h; path = Testing/RKTestFixture.h; sourceTree = "<group>"; };
@@ -1550,7 +1541,6 @@
25160E8D145652E40060A5C5 /* Vendor */ = {
isa = PBXGroup;
children = (
252EFB1214D99222004863C8 /* UDTableView-allowsMultipleSelection */,
49A66B0614CEFAD800A6F062 /* XMLReader */,
49D2759714C9E83E0090845D /* iso8601parser */,
25160E8E1456532C0060A5C5 /* cocoa-oauth */,
@@ -1905,16 +1895,6 @@
path = Logic/Support;
sourceTree = "<group>";
};
252EFB1214D99222004863C8 /* UDTableView-allowsMultipleSelection */ = {
isa = PBXGroup;
children = (
252EFB1314D99222004863C8 /* README.md */,
252EFB1414D99222004863C8 /* UDTableView.h */,
252EFB1514D99222004863C8 /* UDTableView.m */,
);
path = "UDTableView-allowsMultipleSelection";
sourceTree = "<group>";
};
252EFB1F14D9A8D4004863C8 /* Testing */ = {
isa = PBXGroup;
children = (
@@ -1942,8 +1922,6 @@
25EC1AB914F8019F00C3CF3F /* RKRefreshGestureRecognizer.m */,
25EC1ABA14F8019F00C3CF3F /* RKRefreshTriggerView.h */,
25EC1ABB14F8019F00C3CF3F /* RKRefreshTriggerView.m */,
252EFB0014D98EB0004863C8 /* RKTableView.h */,
252EFB0114D98EB0004863C8 /* RKTableView.m */,
25B6E90314CF778D00B1E881 /* RKAbstractTableController.h */,
25B6E90414CF778D00B1E881 /* RKAbstractTableController.m */,
25B6E90614CF778D00B1E881 /* RKAbstractTableController_Internals.h */,
@@ -2199,9 +2177,7 @@
25B6E9F514CF940700B1E881 /* RKSearchWordObserver.h in Headers */,
25B6E9FD14CF943E00B1E881 /* RKCache.h in Headers */,
25B6EA0114CF943E00B1E881 /* RKMutableBlockDictionary.h in Headers */,
252EFB0214D98EB0004863C8 /* RKTableView.h in Headers */,
49A66B1214CF03CA00A6F062 /* RKXMLParserXMLReader.h in Headers */,
252EFB1614D99222004863C8 /* UDTableView.h in Headers */,
252EFB1B14D9A7CB004863C8 /* NSBundle+RKAdditions.h in Headers */,
252EFB2514D9B6F2004863C8 /* Testing.h in Headers */,
253B495214E35D1A00B0483F /* RKTestFixture.h in Headers */,
@@ -2718,10 +2694,8 @@
25B6E9F714CF940700B1E881 /* RKSearchWordObserver.m in Sources */,
25B6E9FF14CF943E00B1E881 /* RKCache.m in Sources */,
25B6EA0314CF943E00B1E881 /* RKMutableBlockDictionary.m in Sources */,
252EFB0414D98EB0004863C8 /* RKTableView.m in Sources */,
49A66B0E14CEFB0400A6F062 /* XMLReader.m in Sources */,
49A66B1414CF03CA00A6F062 /* RKXMLParserXMLReader.m in Sources */,
252EFB1714D99222004863C8 /* UDTableView.m in Sources */,
252EFB1D14D9A7CB004863C8 /* NSBundle+RKAdditions.m in Sources */,
25FABED114E3796400E609E7 /* RKTestNotificationObserver.m in Sources */,
25FABED814E37A2B00E609E7 /* RKTestResponseLoader.m in Sources */,

View File

@@ -1,16 +0,0 @@
UDTableView allowsMultipleSelection backport to pre iOS5
=========
you will need <b>Apple LLVM</b> to compile, alternately you can move declarations from .m to .h and use <b>GCC</b><br /><br />
tested on iOS3.0 (first gen iPhone)<br />
tested on iOS4.2 (iPhone 3GS)<br />
tested on iOS5.0 (iPhone 4)
Pros
----------
drop in replacement (no code to change in your app) just change UITableView to UDTableView. <br />
Implamentation gracefully fallbacks to default iOS implementation if run on iOS5+
Cons
----------
???

View File

@@ -1,18 +0,0 @@
//
// UDTableView.h
// tets
//
// Created by Rolandas Razma on 12/3/11.
// Copyright (c) 2011 UD7. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UDTableView : UITableView
// Stupid iOS5-
@property(nonatomic) BOOL allowsMultipleSelectionDuringEditing;
@property(nonatomic) BOOL allowsMultipleSelection;
@end

View File

@@ -1,289 +0,0 @@
//
// UDTableView.m
// tets
//
// Created by Rolandas Razma on 12/3/11.
// Copyright (c) 2011 UD7. All rights reserved.
//
#import "UDTableView.h"
@interface UDTableView (UDPrivate)
- (void)ud_setAllowsMultipleSelectionDuringEditing:(BOOL)allowsMultipleSelectionDuringEditing;
- (BOOL)ud_allowsMultipleSelectionDuringEditing;
- (void)ud_setAllowsMultipleSelection:(BOOL)allowsMultipleSelection;
- (BOOL)ud_allowsMultipleSelection;
@end
@implementation UDTableView {
BOOL _allowsMultipleSelectionDuringEditing;
BOOL _allowsMultipleSelection;
BOOL _needsMultipleSelectionBackport;
NSMutableSet *_indexPathsForSelectedRows;
NSObject <UITableViewDataSource>*_realDataSource;
NSObject <UITableViewDelegate>*_realDelegate;
}
#pragma mark -
#pragma mark NSObject
- (void)dealloc {
[_indexPathsForSelectedRows release];
[super dealloc];
}
- (id)initWithCoder:(NSCoder *)aDecoder {
if( (self = [super initWithCoder:aDecoder]) ){
[self setAllowsMultipleSelectionDuringEditing: [aDecoder decodeBoolForKey:@"UIAllowsMultipleSelectionDuringEditing"]];
[self setAllowsMultipleSelection: [aDecoder decodeBoolForKey:@"UIAllowsMultipleSelection"]];
}
return self;
}
- (id)forwardingTargetForSelector:(SEL)aSelector {
if ( [_realDataSource respondsToSelector:aSelector] ){
return _realDataSource;
}else if ( [_realDelegate respondsToSelector:aSelector] ){
return _realDelegate;
}
return self;
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
NSString *aSelectorString = NSStringFromSelector(aSelector);
if( [aSelectorString isEqualToString:@"setAllowsMultipleSelectionDuringEditing:"] ){
return [[self class] instanceMethodSignatureForSelector:@selector(ud_setAllowsMultipleSelectionDuringEditing:)];
}else if( [aSelectorString isEqualToString:@"allowsMultipleSelectionDuringEditing"] ){
return [[self class] instanceMethodSignatureForSelector:@selector(ud_allowsMultipleSelectionDuringEditing)];
}else if( [aSelectorString isEqualToString:@"setAllowsMultipleSelection:"] ){
return [[self class] instanceMethodSignatureForSelector:@selector(ud_setAllowsMultipleSelection:)];
}else if( [aSelectorString isEqualToString:@"allowsMultipleSelection"] ){
return [[self class] instanceMethodSignatureForSelector:@selector(ud_allowsMultipleSelection)];
}
return nil;
}
- (void)forwardInvocation:(NSInvocation *)invocation {
NSString *aSelectorString = NSStringFromSelector([invocation selector]);
if( [aSelectorString isEqualToString:@"setAllowsMultipleSelectionDuringEditing:"] ){
[invocation setSelector:@selector(ud_setAllowsMultipleSelectionDuringEditing:)];
[invocation invokeWithTarget:self];
}else if( [aSelectorString isEqualToString:@"allowsMultipleSelectionDuringEditing"] ){
[invocation setSelector:@selector(ud_allowsMultipleSelectionDuringEditing)];
[invocation invokeWithTarget:self];
}else if( [aSelectorString isEqualToString:@"setAllowsMultipleSelection:"] ){
[invocation setSelector:@selector(ud_setAllowsMultipleSelection:)];
[invocation invokeWithTarget:self];
}else if( [aSelectorString isEqualToString:@"allowsMultipleSelection"] ){
[invocation setSelector:@selector(ud_allowsMultipleSelection)];
[invocation invokeWithTarget:self];
}else{
[self doesNotRecognizeSelector:[invocation selector]];
}
}
- (BOOL)respondsToSelector:(SEL)aSelector {
return ( [super respondsToSelector:aSelector] || [_realDataSource respondsToSelector:aSelector] || [_realDelegate respondsToSelector:aSelector] );
}
- (BOOL)conformsToProtocol:(Protocol *)aProtocol {
return ( [super conformsToProtocol:aProtocol] || [_realDataSource conformsToProtocol:aProtocol] || [_realDelegate conformsToProtocol:aProtocol] );
}
#pragma mark -
#pragma mark UITableView
- (void)setDataSource:(id<UITableViewDataSource>)dataSource {
_realDataSource = dataSource;
if( _needsMultipleSelectionBackport ){
[super setDataSource:(id<UITableViewDataSource>)self];
}else{
[super setDataSource:dataSource];
}
}
- (void)setDelegate:(id<UITableViewDelegate>)delegate {
_realDelegate = delegate;
if( _needsMultipleSelectionBackport ){
[super setDelegate:(id<UITableViewDelegate>)self];
}else{
[super setDelegate:delegate];
}
}
- (void)reloadData {
for( NSIndexPath *indexPath in [_indexPathsForSelectedRows allObjects] ){
[self deselectRowAtIndexPath:indexPath animated:NO];
}
[_indexPathsForSelectedRows removeAllObjects];
[super reloadData];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
for( NSIndexPath *indexPath in [_indexPathsForSelectedRows allObjects] ){
[self deselectRowAtIndexPath:indexPath animated:NO];
}
[_indexPathsForSelectedRows removeAllObjects];
[super setEditing:editing animated:animated];
}
- (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition {
if( _needsMultipleSelectionBackport && indexPath && ((_allowsMultipleSelectionDuringEditing && self.isEditing) || (_allowsMultipleSelection && !self.isEditing)) ){
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"tselectRowAtIndexPath:animated:scrollPosition: shouldn't be called because iOS5+ natively supports multiselect");
[_indexPathsForSelectedRows addObject:indexPath];
[[self cellForRowAtIndexPath:indexPath] setSelected:YES animated:animated];
}else{
[super selectRowAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition];
}
}
- (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated {
if( !_needsMultipleSelectionBackport || !_allowsMultipleSelectionDuringEditing ){
[super deselectRowAtIndexPath:indexPath animated:animated];
}else if( _allowsMultipleSelectionDuringEditing && indexPath ){
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"deselectRowAtIndexPath:animated: shouldn't be called because iOS5+ natively supports multiselect");
[_indexPathsForSelectedRows removeObject:indexPath];
[[self cellForRowAtIndexPath:indexPath] setSelected:NO animated:animated];
}
}
#pragma mark -
#pragma mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"tableView:cellForRowAtIndexPath: shouldn't be called because iOS5+ natively supports multiselect");
if( [_indexPathsForSelectedRows containsObject:indexPath] ){
[cell setSelected:YES];
}
if ( [_realDelegate respondsToSelector:@selector(tableView:willDisplayCell:forRowAtIndexPath:)] ){
[_realDelegate tableView:tableView willDisplayCell:cell forRowAtIndexPath:indexPath];
}
}
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"tableView:willSelectRowAtIndexPath: shouldn't be called because iOS5+ natively supports multiselect");
if( [_indexPathsForSelectedRows containsObject:indexPath] ){
[self deselectRowAtIndexPath:indexPath animated:NO];
}else{
[self selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
if( [_realDelegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)] ){
[_realDelegate tableView:tableView didSelectRowAtIndexPath:indexPath];
}
}
return nil;
}
- (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"tableView:willDeselectRowAtIndexPath: shouldn't be called because iOS5+ natively supports multiselect");
return nil;
}
#pragma mark -
#pragma mark UDTableView
- (void)ud_setAllowsMultipleSelectionDuringEditing:(BOOL)allowsMultipleSelectionDuringEditing {
if( _allowsMultipleSelectionDuringEditing == allowsMultipleSelectionDuringEditing ) return;
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"ud_setAllowsMultipleSelectionDuringEditing: shouldn't be called because iOS5+ natively supports multiselect");
_allowsMultipleSelectionDuringEditing = _needsMultipleSelectionBackport = allowsMultipleSelectionDuringEditing;
if( _allowsMultipleSelectionDuringEditing ){
[_indexPathsForSelectedRows release];
_indexPathsForSelectedRows = [[NSMutableSet alloc] init];
if( super.dataSource ) [super setDataSource:(id<UITableViewDataSource>)self];
if( super.delegate ) [super setDelegate:(id<UITableViewDelegate>)self];
}else{
[_indexPathsForSelectedRows release], _indexPathsForSelectedRows = nil;
[self setDelegate:_realDelegate];
[self setDataSource:_realDataSource];
}
}
- (BOOL)ud_allowsMultipleSelectionDuringEditing {
return _allowsMultipleSelectionDuringEditing;
}
- (void)ud_setAllowsMultipleSelection:(BOOL)allowsMultipleSelection {
if( _allowsMultipleSelection == allowsMultipleSelection ) return;
NSAssert(( &UIApplicationLaunchOptionsNewsstandDownloadsKey == NULL ), @"ud_setAllowsMultipleSelectionDuringEditing: shouldn't be called because iOS5+ natively supports multiselect");
_allowsMultipleSelection = _needsMultipleSelectionBackport = allowsMultipleSelection;
if( _allowsMultipleSelection ){
[_indexPathsForSelectedRows release];
_indexPathsForSelectedRows = [[NSMutableSet alloc] init];
if( super.dataSource ) [super setDataSource:(id<UITableViewDataSource>)self];
if( super.delegate ) [super setDelegate:(id<UITableViewDelegate>)self];
}else{
[_indexPathsForSelectedRows release], _indexPathsForSelectedRows = nil;
[self setDelegate:_realDelegate];
[self setDataSource:_realDataSource];
}
}
- (BOOL)ud_allowsMultipleSelection {
return _allowsMultipleSelection;
}
- (NSArray *)indexPathsForSelectedRows {
if( _needsMultipleSelectionBackport ){
return [_indexPathsForSelectedRows allObjects];
}else{
return [super indexPathsForSelectedRows];
}
}
@dynamic allowsMultipleSelectionDuringEditing, allowsMultipleSelection;
@end