小编Shi*_*mar的帖子

NSTableview reloadDataForRowIndexes声音在mac中

我正在为Mac开发一个应用程序,我遇到了一个奇怪的问题.当重载代码执行时,当我重新加载一行和特定列时,我从我的mac获得声音输出.

下面是代码

myTableView.reloadDataForRowIndexes(myTableView.selectedRowIndexes, columnIndexes: NSIndexSet.init(index: myTableView.columnWithIdentifier("source")))
Run Code Online (Sandbox Code Playgroud)

我有一个标识符为"source"的列,当我尝试重新加载时,在执行上面的行后,我的声音在我的mac中.

我使用的是Xcode 7.3,OSX 10.11.6

macos cocoa swift swift2

5
推荐指数
1
解决办法
223
查看次数

在表格视图上滑动是取消选择所有选定的行尾swipeActionsConfigurationForRowAt

最近实施trailingSwipeActionsConfigurationForRowAt,从右向左滑动后显示了两个选项,并且工作正常。但是问题是当我选择多行或单行时,在刷了几行之后它们便被取消选择了。刷卡后是否有办法保持选择?

下面是我的代码

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) ->  UISwipeActionsConfiguration?  {

    let renameAction  = contextualToggleRenameAction(forRowAtIndexPath: indexPath)
    let lastResAction = contextualToggleLastResponseAction(forRowAtIndexPath: indexPath)

    let swipeConfig = UISwipeActionsConfiguration(actions: [renameAction, lastResAction])
    swipeConfig.performsFirstActionWithFullSwipe = false
    return swipeConfig
}

func contextualToggleLastResponseAction(forRowAtIndexPath indexPath: IndexPath) -> UIContextualAction {
    let sensorData = sensorsList?[indexPath.row]
    var lastResponse = ""
    if sensorData != nil{
        if let lstRes = sensorData!["last_response"] as? String{
            lastResponse = lstRes
        }
    }
    let action = UIContextualAction(style: .normal, title: lastResponse) { (contextAction: UIContextualAction, sourceView: UIView, completionHandler: …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

5
推荐指数
1
解决办法
389
查看次数

将 c# windows 面板转换为 c HWND

我有一个接受 HWND 的 dll(dll 中的代码);

void VideoCapture::SetVideoWindow(HWND VidWind)
{
    VideoWindow = VidWind;
}
Run Code Online (Sandbox Code Playgroud)

我通过在引用中添加 dll 在示例 c#.net 应用程序中调用上述 dll,在 c#.net 中我有一个带有面板的表单,是否可以将该面板传递给 dll?我在 C# 中给出了如下代码

VidCapWrapper.ManagedVideoCapture cc = new VidCapWrapper.ManagedVideoCapture();

cc.SetVideoWindow( panel1);
Run Code Online (Sandbox Code Playgroud)

我收到如下错误:'错误 2 'VidCapWrapper.ManagedVideoCapture.SetVideoWindow(HWND__ )'的最佳重载方法匹配有一些无效参数 D:\DirectShow_Capture_GUI\DirectShow_Capture_GUI\Form1.cs 44 13 DirectShow_Capture_GUI 错误 3 参数 1:无法转换从“System.Windows.Forms.Panel”到“HWND__ ” D:\DirectShow_Capture_GUI\DirectShow_Capture_GUI\Form1.cs 44 32 DirectShow_Capture_GUI`

任何人都可以告诉我如何将面板传递给 dll,(任何示例都会很好)?(对不起,我对 .net 很陌生,但试图创建一个示例应用程序,它显示可用的设备,如集成网络摄像头......然后在 c#.net 表单面板上显示预览)

编辑:感谢@Blachshma 和@Hans Passant,现在我可以将c# windows 窗体的面板传递给我的c++ dll。

我将 dll 中的 func 更改为

void VideoCapture::SetVideoWindow(IntPtr windowHandle)
{
    VideoWindow = (HWND)windowHandle.ToPointer();
}
Run Code Online (Sandbox Code Playgroud)

在 c# 中,我将其称为 cc.SetVideoWindow(panel1.Handle);

c# hwnd

3
推荐指数
1
解决办法
6145
查看次数

标签 统计

swift ×2

c# ×1

cocoa ×1

hwnd ×1

ios ×1

macos ×1

swift2 ×1

uitableview ×1