Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nekbeth

macrumors regular
Original poster
Feb 20, 2011
101
0
Vatican City
Hi, I had iAd working with a TableView but I made some changes on my code. Now I can't connect the File's owner and the delegate (it does not show up) Here is the code for the File's owner:

Code:
#import <UIKit/UIKit.h>

#import <iAd/iAd.h>





@interface AllrecipesTableViewController : UIViewController  <UITableViewDelegate, UITableViewDataSource> {

     

    NSArray *RecipesData;

     NSString *CurrentTitle;

     NSInteger CurrentLevel;

          

}



@property (nonatomic, retain) NSArray *RecipesData;

@property (nonatomic, retain) NSString *CurrentTitle;

@property (nonatomic, readwrite) NSInteger CurrentLevel;



//--iAd---

@property (nonatomic, retain) IBOutlet UITableView *allrecipesTableView;

@property (nonatomic, retain) IBOutlet ADBannerView *bannerView;





@end

and here is a photo in Interface Builder of the connections (both from the File's owner and the banner) You can see that the Table View sent it's delegate to the File's Owner but when I try to do the same with the banner, it just won't show any option inside the file owner (photo 3) . The rest of the 4 methods to hide and show the banner are next to the photos. Thank you for you help.

Code:
#pragma mark -

#pragma mark Banner/table frame change methods



- (void)moveBannerViewOffscreen {

     

     //Make the table view take up the void left by the banner.

     CGRect originalTableFrame = self.allrecipesTableView.frame;

     CGFloat newTableHeight = self.view.frame.size.height;

     CGRect newTableFrame = originalTableFrame;

     newTableFrame.size.height = newTableHeight;

     

     //Position the banner below the table view (offscreen)

     CGRect newBannerFrame = self.bannerView.frame;

     newBannerFrame.origin.y = newTableHeight;



     //set frames on their respective views

     self.allrecipesTableView.frame = newTableFrame;

     self.bannerView.frame = newBannerFrame;

}



- (void)moveBannerViewOnscreen {

     

     CGRect newBannerFrame = self.bannerView.frame;

     newBannerFrame.origin.y = self.view.frame.size.height - newBannerFrame.size.height;

     

     CGRect originalTableFrame = self.allrecipesTableView.frame;

     CGFloat newTableHeight = self.view.frame.size.height - newBannerFrame.size.height;

     CGRect newTableFrame = originalTableFrame;

     newTableFrame.size.height = newTableHeight;

     

     [UIView beginAnimations:@"BannerViewIntro" context:NULL];

     self.allrecipesTableView.frame = newTableFrame;

     self.bannerView.frame = newBannerFrame;

     [UIView commitAnimations];

}





#pragma mark -

#pragma mark ADBannerViewDelegate methods



- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error  {

     

     [self moveBannerViewOffscreen];

     

}





- (void)bannerViewDidLoadAd:(ADBannerView *)banner {

     

     [self moveBannerViewOnscreen];

     

}







- (void)viewDidLoad {

     [super viewDidLoad];

     

    [self moveBannerViewOffscreen];
 

Attachments

  • 1.jpg
    1.jpg
    52.8 KB · Views: 130
  • 2.jpg
    2.jpg
    67.2 KB · Views: 107
  • 4.jpg
    4.jpg
    77.5 KB · Views: 140
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.