swift--获取window】的更多相关文章

使用UiDevice获取设备信息: 获取设备名称 let name = UIDevice.currentDevice().name 获取设备系统名称 let systemName = UIDevice.currentDevice().systemName 获取系统版本 let systemVersion = UIDevice.currentDevice().systemVersion 获取设备模型 let model = UIDevice.currentDevice().model 获取设备本地…
本节讲Dom和Bom模型概念讲解(节点获取,window对象). out.js: 写了2个输出到页面的函数. function println(param){ document.write(param+"<br/>"); } function print(param){ document.write(param); } window对象中的方式: 方法: confirm : bConfirmed = window.confirm( [sMessage]) 显示一个确认对话框…
今天使用layui弹出窗口,需要将函数写在弹出的窗口,但是按钮事件是在父层窗口绑定的,这样就要在父层窗口调用子层窗口的函数. 子层函数与父层函数 function topup() { console.log("topup"); } yes: function(index, layero){ var iframe = layero.find('iframe')[0]; var iframeWin = iframe.contentWindow; iframeWin.topup(); } i…
使用UiDevice获取设备信息 获取设备名称 let name = UIDevice.currentDevice().name 获取设备系统名称 let systemName = UIDevice.currentDevice().systemName 获取系统版本 let systemVersion = UIDevice.currentDevice().systemVersion 获取设备模型 let model = UIDevice.currentDevice().model 获取设备本地模…
// 获取屏幕快照 private func screenShot() -> UIImage{ let window = UIApplication.shared.keyWindow! UIGraphicsBeginImageContext(window.size) // 绘图 window.drawHierarchy(in: window.bounds, afterScreenUpdates: false) // 从图形上下文获取图片 let image = UIGraphicsGetImag…
<script> //当浏览器的窗口大小被改变时触发的事件window.onresize window.onresize = function(){ console.log($(window).height()); } //$(document).height() 和$(window).height() 区别 $(document).scrollTop() 获取垂直滚动的距离 (即当前滚动的地方的窗口顶端到整个页面顶端的距离) $(document).scrollLeft() 这是获取水平滚动…
获取手机设备信息,如name.model.version等, 但如果想获取具体的手机型号,如iphone5.5s这种,就需要如下这种(含Swift和OC两种写法) Swift建议添加到extension,使用简单,直接新建个extension,拷贝下面代码进去即可. 以下是最新的类型:一直到iPhone X import Foundation import UIKit public extension UIDevice { var modelName: String { var systemIn…
GetQueryString(param) { //param为要获取的参数名 注:获取不到是为null var currentUrl = window.location.href; //获取当前链接 var arr = currentUrl.split("?");//分割域名和参数界限 ) { arr = arr[].split("&");//分割参数 ; i < arr.length; i++) { var tem = arr[i].split(&…
1.获取状态栏高度: decorView是window中的最顶层view,可以从window中获取到decorView,然后decorView有个getWindowVisibleDisplayFrame方法可以获取到程序显示的区域,包括标题栏,但不包括状态栏. 于是,我们就可以算出状态栏的高度了. Rect frame = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusB…
在开发中,我们常常需要动态地改变按钮标签文字,使用 setTitle() 函数就可以了.有时我们需要在几个标题间切换,比如下面样例所示,按钮点击后按钮文字会在"播放""暂停"间轮流切换.   要实现这个功能,首先要获取按钮当前的标题文字,有如下两种方式:   1,使用currentTitle获取 1 2 3 4 5 if myBtn.currentTitle  == "播放" {     myBtn.setTitle("暂停"…