小编Adr*_*ian的帖子

如何在 Xcode 中添加缺少的 San Francisco 字体?

我正在运行 Xcode 8.3 ,但似乎没有 San Francisco 字体。

我已经从https://developer.apple.com/fonts/下载并安装它。当我在 Mac 上打开 Font Book 时,我可以看到它。

是否有任何其他步骤可以在 Xcode 中添加字体?

编辑:我正在 Interface Builder 中设计我的应用程序,所以我需要在 Xcode 中使用字体来查看它在运行时的外观。

xcode fonts ios

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

在Windows x64上设置openssl时找不到libeay32.lib和ssleay32.lib文件

因此,我试图在Visual Studio中将openssl用于某些加密项目。这些是我到目前为止所做的步骤:

  1. 此处下载Win64 OpenSSL v1.1.1b 。

  2. 设置Additional Include Directories为指向oppenssl / include目录(来自安装)

  3. Additional Dependencies内部链接器设置为:libcrypto.lib
  4. Additional Library Directories在Linker中进行设置以指向openssl / lib目录(来自安装)

现在,当我构建时,我仍然收到很多未定义的引用错误。

从我阅读的内容来看,我仍然需要包含libeay32.liband ssleay32.lib,但是在我的openssl安装目录中的任何地方都找不到它们。

我通过以下链接寻求帮助:

如何在Visual Studio中使用OpenSSL

如何在Visual Studio Expres 2012 Windows 7 x64中包含openssl

显然,我现在唯一的问题是我丢失了这些文件。有人知道我在哪里可以找到他们吗?

c++ windows openssl visual-studio

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

如何在Swift 5中检查字符串是否包含多个字符

我有一个失败初始化器,它接受一个字符串,如果该字符串包含不正确的字符(T,A,C,G),我想返回nil:

我尝试过类似的尝试,但未成功:

init?(strand: String) {
    let success = strand.contains(where:  { !"TACG".contains($0) })
    if !success {
        return nil
    }

    self.strand = strand
}
Run Code Online (Sandbox Code Playgroud)

这两个contains电话让我莫名其妙,所以我不确定我的检查是否正确。
任何帮助表示赞赏。

swift swift5

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

不适用于Storyboard中特定UIView角的角半径不适用于所有角

我为此做了一个自定义类。但这仅适用于左上角,不适用于其他:

@IBDesignable
public class RoundedView: UIView {

    @IBInspectable public var topLeft: Bool = false
    @IBInspectable public var topRight: Bool = false
    @IBInspectable public var bottomLeft: Bool = false
    @IBInspectable public var bottomRight: Bool = false
    @IBInspectable public var cornerRadius: Int = 0

    public override func awakeFromNib() {
        var options = UIRectCorner()

        if topLeft { options =  options.union(.topLeft) }
        if topRight { options =  options.union(.topRight) }
        if bottomLeft { options =  options.union(.bottomLeft) }
        if bottomRight { options =  options.union(.bottomRight) }

        let …
Run Code Online (Sandbox Code Playgroud)

ios uistoryboard swift

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

c ++前向声明

#include <iostream>
#include <cstring>
using namespace std;

class Obj;


class Test {
    friend class Obj;
public:
    Test()
    {

    }
    ~Test()
    {

    }
    void foo()
    {
        //print();
            //Obj::print();
            //Obj x;
            //x.print();
    }
};

class Obj {
public:
    void print()
    {
        cout << "print here" << endl;
    }
};

int main()
{
    Test test;
    test.foo();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

快速问题,如何在Test :: foo()中调用正确的打印方式?

c++

2
推荐指数
1
解决办法
148
查看次数

python中的跨平台代码

我怎么能在python中编写一些windows代码才能在widnows中运行脚本时执行,如果我应该在linux中运行它,那部分windows代码应该被忽略,这与C++相似:

#ifdef windows
  //code
#endif

#ifdef linux
//code
#endif
Run Code Online (Sandbox Code Playgroud)

我在python中尝试过类似的东西:

if os.name = 'nt':
   #code
Run Code Online (Sandbox Code Playgroud)

但在linux中它给了我一个错误(我使用STARTF_USESHOWWINDOW,女巫给出了错误).

startupinfo = None
if sys.platform == 'win32':
    startupinfo = subprocess.STARTUPINFO()
    startupinfo.dwFlags |= _subprocess.STARTF_USESHOWWINDOW #error here
    startupinfo.wShowWindow = _subprocess.SW_HIDE # error here

Traceback (most recent call last):
  File "/home/astanciu/workspace/test/src/main.py", line 10, in <module>
    import _subprocess
ImportError: No module named _subprocess
Run Code Online (Sandbox Code Playgroud)

python

2
推荐指数
1
解决办法
2917
查看次数

使用SendMessage()C++获取文本

我试图从特定窗口中的文本框中获取文本.为此,我使用SendMessage Api函数,我不知道这是否是核心方式:

SendMessage(hwnd, WM_GETTEXT, 0, 0);
Run Code Online (Sandbox Code Playgroud)

但我不知道如何打印文本.对于msdn站点中的参数3和4,它说:附加的消息特定信息.所以我不知道我是否需要在0旁边传递其他东西.我也尝试了这个:

SendMessage(hwnd, WM_GETTEXT, sizeof(text), LPARAM(text));
Run Code Online (Sandbox Code Playgroud)

但它打印文本框的名称,我需要检索框内的文本?
我怎样才能做到这一点?SendMessage()是否使用正确的API函数?

谢谢.

编辑:

我省略说,我从一个窗口枚举子窗口,对我来说它看起来像一个文本框,你必须在其中键入一个名称.我正在检索即时消息窗口的用户名,所以我无法将其与字符串进行比较,这是一个文本框吗?

c++ winapi

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

模板运动问题

我正在尝试使用Thinking in C++ Vol 2进行以下练习,女巫说:

在以下代码中,类NonComparable没有operator =().为什么HardLogic类的存在会导致编译错误,但SoftLogic不会?

#include <iostream>
using namespace std;

class NonComparable {};

struct HardLogic {
    NonComparable nc1, nc2;
    void compare()
    {
        return nc1 == nc2;
    }
};

template<class T>
struct SoftLogic {
    NonComparable nc1, nc2;
    void noOp() {}
    void compare()
    {
        nc1 == nc2;
    }
};

int main()
{
    SoftLogic<NonComparable> l;
    l.noOp();

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

1)HardLogic :: compare返回void但函数尝试返回int/bool.
2)SoftLogic也有一些奇怪的东西(对我来说):nc1 == nc2.
3)练习说的是operator =(),但在代码中它使用的是operator ==().

是错误吗?我发现在这样一本书的代码中出现如此多的错误很奇怪,所以我错过了一些东西吗?以前有没有人遇到这个练习?

c++

2
推荐指数
1
解决办法
821
查看次数

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

不能在以基类为参数的函数中调用派生类方法

我有以下问题:

class A {
   void f() {}
}

class B extends A {   
   void g() {}
}

class C extends A {
   void h() {}
}

void foo(A temp)  
{
   temp.g();
}
Run Code Online (Sandbox Code Playgroud)

我希望我的foo()函数采用基类参数,所以我可以使用B&C.但是在函数内部我调用派生类方法,所以当然我得到一个错误.
我也在foo函数中尝试过这个:

if(temp instanceof B)
{
   B somevar = (B)temp;
}
else if( temp instanceof C)
{
   C someVar = (C)temp;
}

someVar.g();
Run Code Online (Sandbox Code Playgroud)

但是我仍然有一个编译错误,它不知道someVar是谁.我怎么能让这个工作?

谢谢.

java

2
推荐指数
1
解决办法
2102
查看次数

标签 统计

c++ ×5

ios ×2

swift ×2

fonts ×1

java ×1

openssl ×1

python ×1

swift5 ×1

uistoryboard ×1

visual-studio ×1

winapi ×1

windows ×1

xcode ×1