我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)