title: MoPub How to implement iOS Native Ads using MPTableViewAdPlacer with dynamic cell height?
body: <p>I am using a MPTableViewAdPlacer to implement native ads in iOS UITableView. When initialising the MPTableViewAdPlacer, it asks for a MPStaticNativeAdRendererSettings, which needs to implement a viewSizeHandler. However, this is before any ads are fetched, as the name suggested "Static" Native Ad. I am trying to implement one where the cell height can be calculated after getting the adData, such as the title, image...etc. I've been trying to find a way to implement a dynamic cell height but all the sample app, instructions provided by twitter only shows the static height implementation. </p>
  
  <p>Code below:</p>
  
  <pre><code>-(void)setupAdPlacer {
  
      MPNativeAdRequestTargeting *targeting = [MPNativeAdRequestTargeting targeting];
      targeting.location = [[CLLocationManager alloc] init].location;
  
      targeting.desiredAssets = [NSSet setWithObjects: kAdMainImageKey, kAdCTATextKey, kAdTextKey, kAdTitleKey, nil];
  
      MPStaticNativeAdRendererSettings *settings = [[MPStaticNativeAdRendererSettings alloc] init];
  
      settings.renderingViewClass = [REPostListViewMoPubAdCell class];
      settings.viewSizeHandler = ^(CGFloat maximumWidth) {
      return CGSizeMake(maximumWidth, 312.0);
  
      // STATIC HEIGHT
      };
  
      MPNativeAdRendererConfiguration *config = [MPStaticNativeAdRenderer rendererConfigurationWithRendererSettings:settings];
  
      self.adPlacer = [MPTableViewAdPlacer placerWithTableView:self.tableView viewController:self adPositioning:positioning rendererConfigurations:@[config]];
      self.adPlacer.delegate = self;
  
      [self.adPlacer loadAdsForAdUnitID:@"xxxxxxxxxxx" targeting:targeting];
  }
  </code></pre>