These methods return the image map image at the specified index. (LSImage *)objectAtIndexedSubscript:(NSInteger)index (LSImage *)imageAtIndex:(NSInteger)index Image names are sorted alphabetically, and do not necessarily reflect the order in which they appear in the sprite sheet file. This method returns the image name at the specified index. (NSString *)imageNameAtIndex:(NSInteger)index This method returns the number of images in the image map. In this case, you can supply a UIImage to be used as the image map image and the image file specified in the data will be ignored. If the image argument is nil, LSImageMap will attempt to locate the image file from the filename specified in the data, however if the image file is not located in the root of the application bundle, it may not be able to find it. The data should represent the contents of an image map file in one of the formats supported by the imageMapWithContentsOfFile: method. These methods are used to create a LSImageMap from data. (LSImageMap *)initWithUIImage:(UIImage *)image data:(NSData *)data + (LSImageMap *)imageMapWithUIImage:(UIImage *)image data:(NSData *)data It will automatically detect Retina imagemap files and files with the ~ipad suffix. LSImageMap fully supports rotated and trimmed images, as well as image aliases. Currently the only image map file formats that are supported are the Xcode 5 / SpriteKit texture atlas format, and the Cocos2D sprite map format, which can be exported by tools such as Zwoptex or TexturePacker. atlasc file (see "Using Xcode 5 / SpriteKit texture atlasses" below), or a. If the file extension is omitted it is assumed to be and Xcode 5. The parameter can be an absolute or relative file path (relative paths are assumed to be inside the application bundle). These methods are used to create a LSImageMap from a file. (LSImageMap *)initWithContentsOfFile:(NSString *)nameOrPath The LSImageMap class has the following methods: + (LSImageMap *)imageMapWithContentsOfFile:(NSString *)nameOrPath This is not neccesary if the sprite has not been trimmed, but is required to display the sprite correctly if it has been trimmed from its original size. This method sets the bounds and anchorPoint for the sprite. (void)setDimensionsWithLSImage:(LSImage *)image This method does not set the anchorPoint or layer bounds. This rect is measured in unit coordinates, so for images that are not clipped, the contentsRect size will be needed to display the LSImage correctly. The clipping rectangle used to crop and resize the original image to fit the LSImage size. (nonatomic, readonly) CGRect contentsRect For images on Retina display devices this will have a value of 2.0. As with UIImage, on a retina display device the actual pixel dimensions may be twice the size, depending on the scale property. The LSImage class has the following properties: (nonatomic, readonly) CGSize size LSImageView - this is a UIView subclass designed to make it easier to display LSImage sprites in your app. LSImageMap - this is a class for loading image maps, also known as image atlases or spritemaps. It supports all the same image formats as UIImage, and most of the same methods. LSImage - this is a class for representing an image file with associated clipping and transform data. The LayerSprites library currently includes the following classes: To use LayerSprites, just drag the class files into your project and add the QuartzCore framework. tool in Xcode and make sure all files that you wish to use ARC for (including all of the LayerSprites files) are checked. m files, then run the Edit > Refactor > Convert to Objective-C ARC. If you wish to convert your whole project to ARC, comment out the #error line in each of the LayerSprites-related. m files in the list and type -fobjc-arc into the popover. To do this, go to the Build Phases tab in your target settings, open the Compile Sources group, double-click each of the LayerSprites-related. If you wish to use LayerSprites in a non-ARC project, just add the -fobjc-arc compiler flag to all of the LayerSprites class files. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly. 'Compatible' means that the library should work on this iOS version (i.e. NOTE: 'Supported' means that the library has been tested with this version.
0 Comments
Leave a Reply. |