One: Object method, Incoming: Font/maximum size. You can get a wide height,
The maximum size mainly limits the width, if it is a row to a {maxfloat,maxfloat}, if it is more than one line to limit the x value, y value to give
-(Cgsize) Sizewithfont: (Uifont *) font maxSize: (cgsize) maxsize{nsdictionary *attrs = @{nsfontattributename:font} ; return [self boundingrectwithsize:maxsize options:nsstringdrawinguseslinefragmentorigin attributes:attrs context: Nil].size;}
Two: Incoming text/font/maximum size. You can get the text width high
-(Cgsize) Sizewithtext: (NSString *) text font: (Uifont *) font MAXW: (cgfloat) maxw{nsmutabledictionary *attrs=[ Nsmutabledictionary dictionary]; Attrs[nsfontattributename]=font; Cgsize Maxsize=cgsizemake (MAXW, maxfloat); return [text boundingrectwithsize:maxsize options:nsstringdrawinguseslinefragmentorigin attributes:attrs context: Nil].size;} -(Cgsize) Sizewithtext: (NSString *) text font: (Uifont *) font{ return [self sizewithtext:text font:font MAXW: Maxfloat];}
Customize the location of the control settings uilable:
Self.namelabel.frame=cgrectmake (IconX, Icony, ICONWH, ICONWH);
Or:
CGFloat TimeX = NameX; CGFloat timey = Cgrectgetmaxy (self.namelabelf) + hwstatuscellborderw; Cgsize timesize = [self sizeWithText:status.created_at font:hwstatuscelltimefont]; Self.timelabelf = (cgrect) {{TimeX, timey}, timesize};
iOS Uilabel automatically adjusts height based on content