0

我试图将添加实现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'

请任何人帮助。我很困惑我错在哪里......

4

1 回答 1

1

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

于 2011-09-22T20:48:23.700 回答