For example:
In a news app or a magazine app, if you want to display ad(s) ONLY when user reaches "end of content" OR "end of article".
To achieve this –
- (void)viewDidAppear:(BOOL)animated { if (adView == nil) { adView = [[AdvBaralloc] initWithAppId:@"bef99647d04b44ec90c327a5ab599eec"origin:CGPointMake(2.0,1075.0 - 95.0) from:selfadType:@"700x90"adUnitId:2]; // Based on the type of ad view you wish to integrate adType can be @"Square_Ad" or @"FullScreen_Ad" or @"700x90" (Detail View of a SplitViewController) or @"1024x90" (Full Width) or @"Small_Ad" (for a 320x50 ad) adView.tag =232323; adView.mydelegate = self; [self.scrollViewaddSubview:adView]; }
NOTE:
Use your app Id & ad unit Id received on registering this app and this screen (ad zone) in place of: initWithAppId:@"bef99647d04b44ec90c327a5ab599eec"and adUnitId:2
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { float bottomEdge = scrollView.contentOffset.y + scrollView.frame.size.height; if (bottomEdge >= scrollView.contentSize.height) { // we are at the end if(adView != nil) { NSDictionary *dict = [[NSDictionaryalloc] initWithObjects: [NSArrayarrayWithObject:@"food,health"] forKeys: [NSArrayarrayWithObject:@"Tags"]]; // Pass content specific tags (comma separated) and tags that match campaigns you wish to display, in place of "food,health" [[NSNotificationCenterdefaultCenter] postNotificationName:@"CustomTrigger"object: selfuserInfo: dict]; } } } - (void)dealloc { adView.timeOutForQuestion = nil; adView.calledBy = nil; adView = nil; }
Ad being displayed ONLY when user scrolls to end of an article–