2010-08-17 69 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

相關問題