Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue#3: TTPhotoViewController not loading past maxPhotoIndex. …
…This was a forwarding / object-identity bug.
- Loading branch information
Showing
7 changed files
with
151 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// ForwardingAdapters.h | ||
// TTRemoteExamples | ||
// | ||
// Created by Keith Lazuka on 11/30/09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "Three20/Three20.h" | ||
|
||
/* | ||
* HACK: | ||
* | ||
* The TTModel system does not expect that your TTPhotoSource implementation | ||
* is actually forwarding to another object that implements the TTModel aspect | ||
* of the TTPhotoSource protocol. So we must ensure that the TTModelViewController's | ||
* notion of what its model is matches the object that it will receive | ||
* via the TTModelDelegate messages. | ||
*/ | ||
|
||
@class SearchResultsPhotoSource; | ||
|
||
@interface MyPhotoViewController : TTPhotoViewController | ||
{ | ||
id <TTModel> realModel; | ||
} | ||
@property (nonatomic,retain) id <TTModel> realModel; | ||
@end | ||
|
||
|
||
@interface MyThumbsViewController : TTThumbsViewController | ||
{ | ||
id <TTModel> realModel; | ||
} | ||
- (id)initForPhotoSource:(SearchResultsPhotoSource *)source; | ||
@end | ||
|
||
|
||
@interface MyThumbsDataSource : TTThumbsDataSource | ||
{} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// ForwardingAdapters.m | ||
// TTRemoteExamples | ||
// | ||
// Created by Keith Lazuka on 11/30/09. | ||
// Copyright 2009 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "ForwardingAdapters.h" | ||
#import "SearchResultsPhotoSource.h" | ||
#import "SearchResultsModel.h" | ||
|
||
@implementation MyPhotoViewController | ||
|
||
@synthesize realModel; | ||
|
||
- (void)setModel:(id<TTModel>)m { [super setModel:realModel]; } | ||
|
||
- (void)dealloc | ||
{ | ||
[realModel release]; | ||
[super dealloc]; | ||
} | ||
|
||
@end | ||
|
||
@implementation MyThumbsViewController | ||
|
||
- (id)initForPhotoSource:(SearchResultsPhotoSource *)source | ||
{ | ||
if ((self = [super init])) { | ||
realModel = [[source underlyingModel] retain]; | ||
self.photoSource = source; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)setModel:(id<TTModel>)m { [super setModel:realModel]; } | ||
|
||
- (TTPhotoViewController*)createPhotoViewController | ||
{ | ||
MyPhotoViewController *vc = [[[MyPhotoViewController alloc] init] autorelease]; | ||
vc.realModel = realModel; | ||
return vc; | ||
} | ||
|
||
- (id<TTTableViewDataSource>)createDataSource { | ||
return [[[MyThumbsDataSource alloc] initWithPhotoSource:_photoSource delegate:self] autorelease]; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[realModel release]; | ||
[super dealloc]; | ||
} | ||
|
||
@end | ||
|
||
|
||
@implementation MyThumbsDataSource | ||
|
||
- (id<TTModel>)model | ||
{ | ||
return [(SearchResultsPhotoSource*)_photoSource underlyingModel]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters