Cocoa Objective-C,是否有相当于 PHP 会话的东西?
我的应用程序允许用户通过单击按钮创建多个自定义视图(视图是简单的圆圈)。当他们将鼠标放在圆圈上时,我向通知中心发送一条消息并运行核心动画以使视图脉冲(淡入和淡出)。我还将 NSView *activeView 设置为传递到通知中心的视图。
在这些用户创建的视图的后台是一个名为 gameMap 的自定义视图。如果用户点击其中一个圆圈之外,则 gameMap 会向通知中心发送一条消息。
这里应该发生的是 activeView(圆圈)应该移动到鼠标单击点。但是因为NotificationCenter位于我的AppController类中,所以如果通知它在圆形视图之外单击,则它没有可引用的activeView。
我需要一种独立于类的方式来存储 activeView。在 PHP 中,我只使用 $_SESSION['activeView'] = $thisView 或类似的东西。我可以在可可中做这样的事情吗?
My app lets the user create multiple custom views by clicking a button (the views are simple circles). When they mouseDown on the circle I send a message to the NotificationCenter and run Core Animation to make the view pulse (fade in and out). I also set NSView *activeView to the view passed to the NotificationCenter.
In the background of these user created views is a custom view named gameMap. If a user clicks outside of one of the circles then gameMap sends a message to the NotificationCenter.
What should happen here is the activeView (circle) should move to the mouse click point. But because the NotificationCenter is in my AppController class, if it is being notified of a click outside of a circle view it doesn't have an activeView to reference.
I need a way to store, independent of classes, the activeView. In PHP I would just use a $_SESSION['activeView'] = $thisView, or something similar. Can I do something like this in cocoa?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论