CCSprite9Slice Class Reference

Inherits from CCSprite : CCNode : CCResponder : NSObject
Declared in CCSprite9Slice.h

Overview

CCSprite9Slice will render an image in nine quads, keeping the margins fixed and stretching the center quad to fit the content size. The effect is that the image’s borders will remain unstretched while the center stretches.

Setting the Margin

  margin

Sets the margin as a normalized percentage of the total image size. If set to 0.25, 25% of the left, right, top and bottom borders of the image will remain unstretched.

@property (nonatomic, assign) float margin

Discussion

Note: Margin must be in the range 0.0 to below 0.5.

Declared In

CCSprite9Slice.h

Individual Margins

  marginLeft

Adjusts the margin only for this border.

@property (nonatomic, assign) float marginLeft

Discussion

Note: The sum of the this border’s margin plus its opposing border’s margin must not be equal to or greater than 1.0!

Declared In

CCSprite9Slice.h

  marginRight

Adjusts the margin only for this border.

@property (nonatomic, assign) float marginRight

Discussion

Note: The sum of the this border’s margin plus its opposing border’s margin must not be equal to or greater than 1.0!

Declared In

CCSprite9Slice.h

  marginTop

Adjusts the margin only for this border.

@property (nonatomic, assign) float marginTop

Discussion

Note: The sum of the this border’s margin plus its opposing border’s margin must not be equal to or greater than 1.0!

Declared In

CCSprite9Slice.h

  marginBottom

Adjusts the margin only for this border.

@property (nonatomic, assign) float marginBottom

Discussion

Note: The sum of the this border’s margin plus its opposing border’s margin must not be equal to or greater than 1.0!

Declared In

CCSprite9Slice.h