iOS API - sizeThatFits: does not work -


update:

sorry didn't describe enough , incorrectly before.

i did code this:

uiview *view = [[uiview alloc] initwithframe:someframe]; cgsize size = [view sizethatfits:cgsizemake(100, 100)]; 

but when observe size, got nothing: {0, 0}.

do use wrong?

even passed in initial frame view, size still returned nothing.

i searched posts , said uilabel may gets affected.

your view does't contain content , does't have intristic content size, have 0 size.

try these , see works:

uilabel *label [uilabel new]; label.text = @"test test test test"; cgsize size = [label sizethatfits:cgsizemake(20, cgfloat_max)]; 

Comments