2010-08-17 71 views
1

我正在开发具有显示来自服务器的图像作为缩略图列表的iPhone应用程序。我使用Three20包TTThumbViewcontroller类创建了thumbnailview。 alt text如何添加TTThumbviewController(Three20)内的自定义子视图

现在我必须在缩略图视图上方添加横幅视图,如图中所示。此外,我还必须在TTPhotoviewcontroller中添加底部横幅视图。

任何人都可以引导我,如何与任何TTThumbviewConntroller或TTPhotoViewController我父视图一起加入我的自定义横幅视图(UIView的)?

编辑:我已经成功添加一个子视图的延伸TTThumbViewcontroller控制器。现在我必须在TTPhotoViewController工具栏上添加一个子视图(如附图所示)。

在此先感谢。 拉姆

回答

1

旗帜观点只不过是一个普通视图不同。所以你可以用其他视图来做同样的事情。以下是我在我的应用程序使用的代码(我在屏幕底部的同一面旗帜视图中,可以调整它的位置就摆在标签栏上面):

- (void)viewDidLoad{ 
    [super viewDidLoad]; 

    //we don't want user to see the ads at the very first load. 
    //once, it succeeds, it will be animated up by the bannerViewDidLoadAd 
    adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 480, 320, 50)]; 
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50; 
    [adView setDelegate:self]; 
    [self.view addSubview:adView]; 
    self.bannerIsVisible = NO; 


} 


- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{ 
    if (!self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOn" context:NULL]; 

     adView.frame = CGRectMake(0, 346, 320, 50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = YES; 


    } 
} 

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
{ 
    if (self.bannerIsVisible) 
    { 
     [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 

     adView.frame = CGRectMake(0, 480, 320, 50); 
     [UIView commitAnimations]; 
     self.bannerIsVisible = NO; 
    } 
} 

- (void)dealloc{ 
    adView.delegate = nil; 
    [adView release]; 
    [super dealloc]; 
} 
+0

任何可能创建一个子视图在TTThumbviewConntroller和TTPhotoViewController中。 – Pugal 2010-08-17 17:57:24

+0

感谢您的回复。我的问题是,我有一个UIViewController中(如:galleryViewController)我想补充TTThumbviewcontroller的实例作为一个子视图我GalleryViewController。另外我想添加一个自定义的UIView(bView)到我的GalleryViewController。我可以通过[self.view addsubview:bView]添加我的自定义UIView。但我无法添加通过[self.view addsubview:TTTHumbInsace.view]安装的TTThumbviewcontroller。 – Ram 2010-08-17 18:23:38

+0

@Pugal,为什么不呢?它们只是标准视图。 @Ram:那么你是在问一个非常基本的问题,这个问题与Three20无关,而是一般的iPhone问题。查看视图管理的一些文档。你的第一个问题,这是不可能的,第2个:一个自定义的UIView是没有任何问题您galleryviewcontroller添加,在上面的答案,AdView的是一个自定义的UIView你说,在头宣布它和你做。 – 2010-08-18 07:45:22

相关问题