Delegate for Working with Tree Map Data View

Description: delegate for working with tree map data view.

The MATreeMap3DViewControllerDelegateImpl.h File

#import <MobileAnalysis/MATreeMap3DViewController.h>
#import <MobileAnalysis/MATreeMapDataViewController.h>
#import "TreeMapDataViewDataSource.h"

@interface MATreeMap3DViewControllerDelegateImpl : MATreeMap3DViewController<MATreeMap3DViewControllerDelegate> {
}

// Sets controller for working with tree map base data view
-(void)setTreeMap3DViewController: (MATreeMap3DViewController *) treeMap3DViewController
withDataSource: (TreeMapDataViewDataSource *) treeMapDataSource;

@end

The MATreeMap3DViewControllerDelegateImpl.mm File

#import "MATreeMap3DViewControllerDelegateImpl.h"

@implementation MATreeMap3DViewControllerDelegateImpl
- (void)controlWillAppear:(MATreeMap3DViewController *)controller {
    UIImage *screenshot = [controller generateScreenshot];
    // Determine path to file, to which image should be saved
    NSString  *pngPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/MATreeMap3DViewController.png"];
    NSLog(@"Screenshot file path: %@", pngPath);
    // Save image to file
    [UIImagePNGRepresentation(screenshot) writeToFile:pngPath atomically:YES];
}

// Sets controller for working with tree map base data view
-(void)setTreeMap3DViewController: (MATreeMap3DViewController *) treeMap3DViewController
                   withDataSource: (TreeMapDataViewDataSource *) treeMapDataSource {
    MATreeMapDataViewController *treeMapViewController = [MATreeMapDataViewController new];
    [treeMapViewController setValue:treeMap3DViewController forKey:@"m_treeMapController"];
    [treeMapViewController setValue:treeMapDataSource forKey:@"m_dataSource"];
}

@end

See also:

Working with a Tree Map Base Data View