在 UIViewController 上实现 TTThumbsViewController?

发布于 2024-12-06 02:03:00 字数 1677 浏览 0 评论 0原文

我尝试将 TThumbsViewController 添加为 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'

请任何人帮忙。我完全困惑我哪里错了......

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无戏配角 2024-12-13 02:03:00

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

your view controller has to be a type TTThumbsViewController and not a UIViewControler for starters.. Check the TTCatalog app in the samples folder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文