Skip to content

Best Practices Old Revision

azeitler edited this page Jan 24, 2012 · 1 revision

Customizing Assets: Loading View, ARController

There are two important assets which determine how the ARView will look. The ARController.xib file is the main interface file of the ARController and contains the main view hierarchy as well as the loading view. The ARController manages a quite complex view hierarchy and may at times be allergic to tempering and manipulation, especially if done by code. Should you wish to customize the look of the ARController (and the Loading View), please do so in Interface Builder and save the changes to the ARController.xib file.

Please note that replacing the Loading View via Code will not work properly as the newly created view will not be embedded in the view hierarchy correctly. Example:

_arController.loadingView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]] autorelease];

Customizing the Loading View can be done with Interface Builder.

Customizing Assets: Marker Templates,

The MarkerTemplate.xib files determine how a Marker will look when it is rendered. The Marker Templates are pretty flexible and can be customized using Interface Builder or by code. Please note that only Marker Templates which have power-of-two width and height will be displayed properly (i.e. 512x256, 512x512, 512x128, or any variation thereof).

Loading Templates resolution-dependently

For technical reasons PanicAR does not support automatic loading of resolution-dependent assets (with '@2' notation in file names). In case you want to load a resolution-dependent asset you have to do so manually for now. Here is a code snippet to show you how:

	contentScale = [UIScreen mainScreen].scale; // 4.x API call
	BOOL needsHighRes = (contentScale > 1.0);
	ARMarkerTemplate* myTemplate = [ARMarkerTemplate loadMarkerTemplate:(needsHighRes ? @"ImageMarker_2x" : @"ImageMarker") aspect:0.5];