在UIViewController上实现TTThumbsViewController?

时间:2011-09-22 07:41:26

标签: uiviewcontroller three20 ttthumbsviewcontroller

我正在尝试添加TTThumbsViewController作为UIViewController的子视图,但应用程序正在崩溃。在这里,您可以看到代码 -

.h文件 -

#import <UIKit/UIKit.h>
#import <Three20/Three20.h>
#import <Three20UI/UIViewAdditions.h>
#import "MockPhotoSource.h"

@interface photos : UIViewController <NSXMLParserDelegate, TTThumbsViewControllerDelegate>
{
    TTThumbsViewController *photoSource;
...........
}

.m文件 -

    - (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
    }

这里是错误显示 -

-[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'

请任何人帮忙。我完全糊涂了,我错了......

1 个答案:

答案 0 :(得分:1)

您的视图控制器必须是类型TTThumbsViewController,而不是UIViewControler的初学者。检查示例文件夹中的TTCatalog应用程序