views:

185

answers:

1

Hi, i am developing an iphone application which have to show images from server as thumbnail list. I have created thumbnailview using Three20 package TTThumbViewcontroller class. alt text

Now i have to add banner view above the thumbnail view as shows in the image. Also i have to add the bottom banner view in the TTPhotoviewcontroller also.

can anyone guide me, how to add my custom banner view (UIView) along with either TTThumbviewConntroller or TTPhotoViewController to my parent view?

Edit:I had successfully added a subview for the controller which extends TTThumbViewcontroller. Now i have to add a subview above the TTPhotoViewController toolbar (as in the attached image).

thanks in advance. Ram

A: 

The banner view is nothing different than a normal view. So you could do the same with any other view. Following is the code I use in my app (I have the same banner view at the bottom of the screen, you can adjust its position to put in above the tab bar):

- (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];
}
sfa
@sfa, Is any possible to create a subview in TTThumbviewConntroller and TTPhotoViewController.
Pugal Devan
@sfa, Thanks for your reply note. My question is, i am having one UIViewController (eg: galleryViewController) i want to add instance of TTThumbviewcontroller as a subview to my GalleryViewController. Also i want to add a custom UIView (bView) to my GalleryViewController. i can add my custom UIView through [self.view addsubview:bView]. but i couldn't add TTThumbviewcontroller installed through [self.view addsubview:TTTHumbInsace.view].
Ram
@Pugal, why not? They are just standard views. @Ram: then you are asking a very basic question, which does not relate to Three20, but to iPhone in general. Check out some documentation on views management. for your 1st question, it is NOT possible, 2nd: a custom UIView is added without any problem to your galleryviewcontroller, in the answer above, adView is a custom UIView that you said, declare it in the header and you are done.
sfa