Invoking Ad(s) at End of an Article / Content


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

  1. Initialize ad view of your choice in article's (or content's ) viewDidAppear method.

     

    - (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

     

  2. Post an ad trigger with content specific tags (and tags which match ad campaigns you wish to display) under scrollViewDidEndDecelerating

     

    - (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–

 

Back to Top