如何传递UnsafeMutablePointer类型的参数>(How to pass parameter of type UnsafeMutablePointer>)
我必须在Swift中使用
CFDictionaryCreate
方法( 文档链接 )。我很难正确初始化输入参数,以便传递类型
UnsafeMutablePointer<UnsafePointer<Void>>
参数(键和值)。这是我的代码:
var font_name: CFStringRef! = CFStringCreateWithCString(nil, "Courier", kCFStringEncodingASCII) var font: CTFontRef! = CTFontCreateWithName(font_name, 25.0, nil) var keys: [UnsafePointer<Void>] = ???? // how to intialize with "kCTFontAttributeName" var values: [UnsafePointer<Void>] = ???? // how to intialize with "font" variable var keyCallBacks = kCFTypeDictionaryKeyCallBacks var valueCallBacks = kCFTypeDictionaryValueCallBacks var font_attributes: CFDictionaryRef! = CFDictionaryCreate(kCFAllocatorDefault, &keys, &values, sizeofValue(keys), &keyCallBacks, &valueCallBacks) var attr_string: CFAttributedStringRef! = CFAttributedStringCreate(nil, "hello", font_attributes)
I have to use
CFDictionaryCreate
method in Swift(documentation link).I am having a hard time to initialize the input parameters correctly in order to pass parameters(keys and values) of type
UnsafeMutablePointer<UnsafePointer<Void>>
.Here is my code:
var font_name: CFStringRef! = CFStringCreateWithCString(nil, "Courier", kCFStringEncodingASCII) var font: CTFontRef! = CTFontCreateWithName(font_name, 25.0, nil) var keys: [UnsafePointer<Void>] = ???? // how to intialize with "kCTFontAttributeName" var values: [UnsafePointer<Void>] = ???? // how to intialize with "font" variable var keyCallBacks = kCFTypeDictionaryKeyCallBacks var valueCallBacks = kCFTypeDictionaryValueCallBacks var font_attributes: CFDictionaryRef! = CFDictionaryCreate(kCFAllocatorDefault, &keys, &values, sizeofValue(keys), &keyCallBacks, &valueCallBacks) var attr_string: CFAttributedStringRef! = CFAttributedStringCreate(nil, "hello", font_attributes)
原文:https://stackoverflow.com/questions/30143515
更新时间:2022-07-15 06:07
最满意答案
我认为问题是错字:
$('.background-image').css({backgroundImage: 'url('+theURL+backSwitch+')'});
尝试从CSS url属性中删除分号。
你也可以像这样写:
$('.background-image').css({'background-image': 'url('+theURL+backSwitch+')'});
I think the problem is a typo:
$('.background-image').css({backgroundImage: 'url('+theURL+backSwitch+')'});
Try removing the semicolon from the CSS url property.
You could also write it like this:
$('.background-image').css({'background-image': 'url('+theURL+backSwitch+')'});
相关问答
更多-
jquery设置背景图片问题[2023-04-23]
改成$(this).css("background-image","url(on.jpg)");就可以了 -
你必须这样做: var url = $('#myDiv').css('background-image').replace('url(', '').replace(')', '').replace("'", '').replace('"', ''); var bgImg = $(''); bgImg.hide(); bgImg.bind('load', function() { var height = $(this).height(); alert(height); }); ...
-
那么,如果有人会遇到同样的问题,我发布这个解决方案:我们必须改变这个: slide.css('background-image',"url(../img/sl_"+cur_slide+".jpg)"); 对此: slide.css('background-image',"url(img/sl_"+cur_slide+".jpg)"); Well, if someone will get the same problem, i post this solution: We have to change t ...
-
您不会在此代码中的任何位置更改i的值... You don't change the value of i anywhere in this code...
-
在多个元素上内联调用javascript函数时存在一些问题。 它以未定义的形式返回您的图片源。 这里有一个我为你工作的jsfiddle 。 我认为这是你正在尝试的。 我从图像元素内嵌移除了onmousenter函数,并将其放入单独的函数中。 这样做使得它如此var img_src = $(this).attr("src"); 将不再返回undefined。 所以以前的建议解决方案会正常工作。 我希望jsfiddle有所帮助。 $('.thumb').mouseenter(function() { var ...
-
尝试这个: $('body').css({background : 'url(images/wallpaper/'+wp+'.jpg) no-repeat fixed bottom left'}); Try this: $('body').css({background : 'url(images/wallpaper/'+wp+'.jpg) no-repeat fixed bottom left'});
-
我认为问题是错字: $('.background-image').css({backgroundImage: 'url('+theURL+backSwitch+')'}); 尝试从CSS url属性中删除分号。 你也可以像这样写: $('.background-image').css({'background-image': 'url('+theURL+backSwitch+')'}); I think the problem is a typo: $('.background-image').css( ...
-
更改背景图片时出错(Error changing background image)[2023-05-15]
改为使用它: $("html").css({ "background": "url('../images/visuals/visual3-edit.jpg') center center fixed no-repeat" }); 或者如果你只是改变图像...... $("html").css({ backgroundImage: "url('../images/visuals/visual3-edit.jpg')" }); 不确定你的意思是不同的页面。 你可以说得更详细点吗? 另外,尝试: $("htm ... -
jQuery背景图片转换(jQuery background image transition)[2022-08-06]
唯一的方法是使用新背景淡入另一个元素。 或者,您可以立即更改背景,然后使用旧背景创建一个新元素并将其淡出。 The only way to do this is to fade in another element with the new background. Alternatively, you could change the background immediately, then create a new element with the old background and fade it o ... -
你可以使用CSS和jQuery。 更新HTML以使用指向默认图像的默认类,如下面的示例home :television test
相关文章
更多- Java泛型父类取得子类的泛型参数T的Class类型
- ServletOutputStream cannot be resolved to a type
- HTTP Content-Type 内容类型详解
- 微信公众号接口添加菜单时错误(errcode":40017 invalid button type)
- The content of element type "package" must match "...
- Java变量类型
- 关于两种对象类型使用
- js 怎么传递数组参数到servlet?
- 深入浅出dwr系列教程之2传参数及处理各种类型的返回值
- sencha touch routes(路由) 传递中文参数
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)