小编use*_*092的帖子

NSString特定于帧宽度的字体大小

drawRect用于文本显示,打电话NSString.我正在尝试使用sizeWithFont默认字体大小为17自动调整字体大小(缩小)并使用循环将字体大小减小1,如果它不适合宽度的大小.任何人都可以帮我解决这个问题吗?现在示例很好我只需要将字体大小设置为17.0

[[self.string displayName] drawAtPoint:CGPointMake(xcoord, ycoord) withFont:[UIFont boldSystemFontOfSize:17.0]];
CGSize size = [[self.patient displayName] sizeWithFont:[UIFont boldSystemFontOfSize:17.0]];
max_current_y = size.height > max_current_y ? size.height : max_current_y;
xcoord = xcoord + 3.0f + size.width;
Run Code Online (Sandbox Code Playgroud)

objective-c nsstring drawrect sizewithfont

3
推荐指数
3
解决办法
7089
查看次数

标签 统计

drawrect ×1

nsstring ×1

objective-c ×1

sizewithfont ×1