小编Her*_*rwr的帖子

iOS是否提供任何功能来检测外部屏幕是"硬连线"TV Out/HDMI还是"网络"Airplay显示器/设备?

我一直在寻找一种方法来确定iOS外部屏幕是否有线连接或通过无线方式找不到任何明显的方法.

我在这里看过非官方的AirPlay规格,但看不到任何明显的检测方法.有没有人知道是否可以使用legal /'public'API完成此操作.

ios airplay

8
推荐指数
2
解决办法
1707
查看次数

CATiledLayer drawLayer:始终在主线程上调用inContext - MacOS El Capitan

我正在使用CATiledLayer支持的NSView(Mac而不是iOS),根据Apple文档https://developer.apple.com/reference/quartzcore/catiledlayer我希望在多个线程上异步调用它以帮助提高性能,不过它似乎只是在主线程上被调用.

我正在做的工作 drawLayer(layer: CALayer, inContext ctx: CGContext)

我已经canDrawConcurrently在NSView上启用了以及确保窗口allowsConcurrentViewDrawing设置为true(默认),但它仍然总是调用每个tile rect的主线程.

我需要在显示之前进行一些图像处理,这取决于需要显示的矩形区域,并且在主线程上运行会影响性能.

任何想法我怎么能强迫它在后台线程上调用?

我已经尝试将操作编组到后台线程上,然后使用以下内容调用主队列,但它显示一个空白的矩形:

backgroundQueue.addOperationWithBlock({ [ weak self ] in            
    guard let strongSelf = self else { return }

    // ** This is the part I nee to do in background that can take some time
    guard let image = strongSelf.imageForTileRect(layerBounds, imageSize: imageSize) else { return }
    // ** End background bit

    var rect = layerBounds
    let rectImageRef = image.CGImageForProposedRect(&rect, context: nil, hints: nil)

    if (rectImageRef …
Run Code Online (Sandbox Code Playgroud)

macos core-animation calayer nsview catiledlayer

7
推荐指数
1
解决办法
501
查看次数

标签 统计

airplay ×1

calayer ×1

catiledlayer ×1

core-animation ×1

ios ×1

macos ×1

nsview ×1