let c = this.node.getComponent(cc.Canvas);c.fitHeight = true;c.fitWidth = false; let h = 960 * cc.winSize.height / cc.winSize.width; c.designResolution = new cc.Size(960, h);this.node.setContentSize(960, h); // 适配解决方案 let _canvas = cc.Canvas.instance
<script type="text/javascript"> var s = " "; document.documentElement.scrollTop 就是滚动条距离顶部的位置(可变) document.documentElement.scrollLef 指滚动条距离左边的位置(可变) s += "\r\n<br>网页可见区域宽: "+ document.body.clientWidth; s += "\
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //获取字符串的宽度 NSLog(@"获得字符串的宽度:%f",[self widthForString:@"我爱你!我爱你!我爱你!我爱你!我爱你!我爱你!我爱你!我爱你!" fontSize:10.0 andHeight: