CCLabelTTF with fixed width and dynamic height solution
来源:互联网 发布:algorithm基础算法 编辑:程序博客网 时间:2024/05/23 11:25
CGSize size =[[CCDirectorsharedDirector]winSize];NSString *str = [NSString stringWithString:@" did a bit of research and was able tofind out the size of an nsstring within a constraint then applythat to the label which has worked so far for me. Hopefully thiscan help someone stuck with the same problem I was having. I dohowever get a bunch of context errors which I have no idea how tofix, but they don't seem to stop anything fromworking."];UIFont *font = [UIFont fontWithName:@"Marker Felt" size:16];CGSize compSize = [str sizeWithFont:font constrainedToSize:CGSizeMake(size.width *0.8,2000)lineBreakMode:UILineBreakModeWordWrap];CCLabelTTF *label = [CCLabelTTF labelWithString:str dimensions:compSize alignment:UITextAlignmentLeft fontName:@"MarkerFelt" fontSize:16];NSLog(@"width:%f, height:%f",compSize.width,compSize.height);label.position= ccp(size.width /2 , size.height/2 );[self addChild: label];
0 0
- CCLabelTTF with fixed width and dynamic height solution
- Center parent div with dynamic and set width child divs
- Set Height and Width Pie Chart
- studyjams notes 1B--width and height
- 得到屏幕的Width And Height
- web-屏幕、浏览器、页面-width and height
- width height
- yuv420sp crop from any startpoint and width and height
- Latex 学习三 bold, italic, fixed-width font, and commenting
- Calculate height and width of GIF/JPG files
- About the Height and Width property of DisplayObject
- Android get layout height and width in a fragment
- do you have "has ambiguous scrollable content width and height"
- React-Native 基础(五) Height and Width
- java.lang.IllegalArgumentException: width and height must be > 0
- IE8 BUG WITH MAX-WIDTH AND OVERFLOW
- 100%height with padding and margin
- Dynamic Table View Cell Height and Auto Layout
- NSUserDefaults not get saved sometime
- 生产者消费者模型
- MYSQL to SQLite 脚本
- 不建议使用rowid作为sqlite主键
- CI 获取数据库数据类型总是为STRING 的解决方案
- CCLabelTTF with fixed width and dynamic height solution
- Erlang性能的八个误区(Efficiency Guide)
- MYSQL DB SYN
- NAT穿透
- Socket服务器整体架构概述
- uva10422(Knights in FEN)-bfs+哈希(隐式图搜索)
- MYSQL LIMIT NOT WORK WHEN ESTIMATE NUMBER OF ROWS
- CCSPRITE:Load image from users documents folder
- menuconfig 缺失 MTD partitioning support 解决办法