ADKNibSizeCalculator Class Reference

Inherits from NSObject
Declared in ADKNibSizeCalculator.h
ADKNibSizeCalculator.m

+ sharedInstance

Geting a shared instance of ADKNibSizeCalculator.

+ (instancetype)sharedInstance

Return Value

Instance of ADKNibSizeCalculator.

Declared In

ADKNibSizeCalculator.h

– sizeForNibNamed:

This is a method for nibsize calculation with default style.

- (CGSize)sizeForNibNamed:(NSString *)nibName

Parameters

nibName

input nibfile identifier, shoulf be in string.

Return Value

CGSize of the calculated nibfile.

Declared In

ADKNibSizeCalculator.h

– sizeForNibNamed:withStyle:

This is a method for nibsize calculation, various of calculation style parameter can be input here

- (CGSize)sizeForNibNamed:(NSString *)nibName withStyle:(ADKNibSizeStyle)style

Parameters

nibName

input nibfile identifier, shoulf be in string

style

There are currently 5 types of style, as following: ADKNibOriginalSize = return original nibfile size, e.g. input nibsize = (320, 480), output size = (320, 480), used in little occations ADKNibDefaultScaling = return aspect ratio fill nibfile size, e.g. input nibsize = (320, 480) screenwidth = 640.0f, output size = (640, 960), often used for banner cells, text cells and pure pic cells ADKNibBottomFixedScaling = return aspect scaled for the image part, but original height for the text field part nibfile size, e.g. input nibsize = (320, 480) screenwidth = 640.0f, output size = (640, 800), often used for largecell and discovery item cells

ADKNibFixedHeightScaling = return width scaled to screen, height fixed to nibsize, e.g. input nibsize = (320, 480) screenwidth = 640.0f, output size = (640, 480), often used for pure text cells, since fontsize does not scale up in autolayout

ADKNibCustomCalculation = return the size calculated by the nibfile’s corresponding class' sizeThatFitsWidth: method if the corresponding class doesn’t conform to ADKNibSizeCustomCalculationProtocol, it would use ADKNibDefaultScaling instead

ADKNibUncachedCustomCalculation = the same as ADKNibCustomCalculation except that ADKNibUncachedCustomCalculation doesn’t cache the calculated size

Return Value

CGSize of the calculated nibfile.

Declared In

ADKNibSizeCalculator.h

– sizeForNibNamed:withStyle:fitSize:

Same as sizeForNibNamed:, use assigned size instead

- (CGSize)sizeForNibNamed:(NSString *)nibName withStyle:(ADKNibSizeStyle)style fitSize:(CGSize)containerSize

Parameters

nibName

input nibfile identifier, shoulf be in string

style

same as sizeForNibNamed:

containerSize

bounds that nib file will fit.

Return Value

CGSize of the calculated nibfile.

Declared In

ADKNibSizeCalculator.h