有没有办法做到这一点?我UIPasteboardChangedNotification在发布时注册了我的对象,但是当它发送到后台并打开(例如)Safari并复制一些文本时,我的处理程序永远不会被调用.(我现在只使用模拟器).
我用过两个:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pasteboardNotificationReceived:)
name:UIPasteboardChangedNotification
object:[UIPasteboard generalPasteboard]];
Run Code Online (Sandbox Code Playgroud)
和:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(pasteboardNotificationReceived:)
name:UIPasteboardChangedNotification
object:nil ];
Run Code Online (Sandbox Code Playgroud)
注册我的处理程序.
考虑以下代码:
class Program
{
static void Main(string[] args)
{
var instance = Activator.CreateInstance<Person>();//No parameterless constructor defined for this object.
}
}
public class Person
{
public Person(string name = "Shahrooz") { }
}
Run Code Online (Sandbox Code Playgroud)
使用此代码时:Activator.CreateInstance<Person>();我收到此错误:
没有为此对象定义的无参数构造函数.
请注意,我的构造函数有默认参数:string name ="Shahrooz"
为什么我们不能从具有构造函数的类创建实例,尽管构造函数具有默认值参数?
.net Core 3.0 中添加了 WPF 支持
我可以在 Linux 或基于 Linux 的 docker 容器中编译 wpf 应用程序吗?