Reputation: 12908
Im trying to implement add TTThumbsViewController
as a subview of UIViewController
but the app is crashing. Here you see the code-
.h file-
#import <UIKit/UIKit.h>
#import <Three20/Three20.h>
#import <Three20UI/UIViewAdditions.h>
#import "MockPhotoSource.h"
@interface photos : UIViewController <NSXMLParserDelegate, TTThumbsViewControllerDelegate>
{
TTThumbsViewController *photoSource;
...........
}
.m File-
- (void)viewDidLoad {
// parsing a feed
[self parseXMLFileAtURL:@"http://feed203.photobucket.com/albums/aa15/vikysaran/Worst%20Parents/feed.rss"];
NSMutableArray *arr = [[NSMutableArray alloc]init];
for (int i=0; i < [stories count];i++) {
[arr addObject:[[[MockPhoto alloc] initWithURL:[[stories objectAtIndex:i] objectForKey:@"fullimageurl"] smallURL:[[stories objectAtIndex:i] objectForKey:@"thumburl"]
size:CGSizeMake(960, 1280)] autorelease]];
}
photoSource = [[[MockPhotoSource alloc] initWithType:MockPhotoSourceNormal title:nil photos:[NSArray arrayWithArray:arr] photos2:nil]autorelease];
// till here the code is working fine if i am not using uiviewcontroller
NSLog(@"mockphoto%@", arr);
[self.view addSubview:photoSource.view];// adding to uiview
}
here is the error displays-
-[MockPhotoSource view]: unrecognized selector sent to instance 0x6924ca0
2011-09-22 13:07:07.375 JesonTerry[1969:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MockPhotoSource view]: unrecognized selector sent to instance 0x6924ca0'
Please anybody help. i am totally confused where i am wrong...
Upvotes: 0
Views: 216
Reputation: 5932
your view controller has to be a type TTThumbsViewController
and not a UIViewControler
for starters.. Check the TTCatalog app in the samples folder
Upvotes: 1