将 iOS (iPhone) 应用程序移植到 Mac?

发布于 2024-10-10 08:20:07 字数 516 浏览 4 评论 0原文

有没有首选的方法来解决这个问题?

有问题的应用程序不太大。 。 。我花了几个月的时间编写的单人游戏。

编辑:我应该补充一点,我没有 mac 开发经验。 。 。除了作为一名 iOS 开发人员自然而然的事情之外。

编辑:游戏中大量使用的类:NSObject、UIView 和 UIViewController 的子类。我对 NSView 不太了解,但我很确定所有 UIView 的东西都可以在该类中工作。还有一些UITableViewController的使用。我也有游戏中心,但我现在可以忽略这一部分。没有多点触控。

编辑:我的图形是 QuartzCore 和 CoreGraphics 框架中的所有内容。我确实有一个中等的视图层次结构。

编辑:如果您正在进行这样的移植,您可能还会对 内存管理

Is there a preferred way to go about this?

The app in question is not too large . . . single-player game that I wrote over the course of a couple of months.

EDIT: I should add that I have no experience with mac development . . . outside of what comes naturally with being an iOS developer.

EDIT: Classes heavily used in the game: subclasses of NSObject, UIView, and UIViewController. I don't know much about NSView, but I'm pretty sure all the UIView stuff will work in that class. Also some use of UITableViewController. I do also have Game Center, but I can leave that part out for now. There is no multi-touch.

EDIT: My graphics is all stuff that is in the QuartzCore and CoreGraphics frameworks. I do have a moderate view hierarchy.

EDIT: If you are doing such a port, you may also be interested in the issue of memory management

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

£噩梦荏苒 2024-10-17 08:20:07
  1. 没有简单的方法。就是这么简单。令人沮丧的是,您只需要擅长 Mac 编程即可。

  2. “我很确定所有 UIView 内容都可以在该类中使用” - 不幸的是,不能。一切都不同了,你必须努力工作。

这不是一场有趣的演出。确保你真的、真的认为这在经济上是值得的。

除此之外,如果您在 iOS 应用程序中堆叠大量视图,请注意“同级视图在 OSX 上不起作用”问题。本质上,如果您在手机上依赖嵌套的视图层次结构,则必须在 Mac 上改为使用图层(而不是简单的视图)!

单击此链接: 是否有合适的处理重叠 NSView 兄弟姐妹的方法? 了解该特定问题的血淋淋的细节!

  1. There's no easy way. It's that simple. Depressingly, you simply have to become good at programming the Mac.

  2. "I'm pretty sure all the UIView stuff will work in that class" -- unfortunately, no. Everything is different that enough you have to work hard.

It's not a fun gig. Make sure you really, really think it's worth it financially.

Apart from anything else, be aware of the "sibling views don't work on OSX" problem if you stack up a lot of views in your iOS app. Essentially, you will have to change to using layers (instead of simply views) on the Mac if you rely on nested hierarchies of views here and there on the phone!

Click this link: Is there a proper way to handle overlapping NSView siblings? for the gory details on that particular problem!

北方。的韩爷 2024-10-17 08:20:07

http://chameleonproject.org/ Mac 版 UIKit
来自 Iconfactory 的值得一试。

“Chameleon 是一项正在进行中的工作。经过九个月的工作,该框架目前实现了 UIKit 的约 60%。”

https://github.com/BigZaphod/Chameleon

http://chameleonproject.org/ UIKit for Mac
from Iconfactory is worth checking out.

"Chameleon is a work in progress. The framework currently implements about 60% of UIKit after nine months of work."

https://github.com/BigZaphod/Chameleon

记忆里有你的影子 2024-10-17 08:20:07

您可能还有很多工作要做。虽然纯算法类将在不进行任何更改的情况下进行移植,但任何涉及 UIKit 的内容都可能需要重写或进行大量调整。 OSX 上的 UI 类设计模式是视图之间的关系,您的代码负责管理控制器;而在 iOS 上,它是视图控制器之间的一种关系,其中隐含着视图管理。

当然,正如 BoltClock 提到的,你有交互的问题。由于触摸不再起作用,您可能需要先研究交互模型,甚至在开始移植之前也是如此。

You may have a lot of work ahead of you. While purely algorithmic classes will port without any change, anything that touches UIKit will likely need to be rewritten, or heavily adapted. The UI class design pattern on OSX is that of a relationship between views, where your code is responsible for managing controllers; while on iOS it is one of a relationship between view controllers, where view management is implied.

Of course, as BoltClock mentioned, you have the issue of interaction. Since touch no longer works, you will probably need to work on your interaction model first, even before you start porting.

原来是傀儡 2024-10-17 08:20:07

存在一个开源 (BSD) UMEKit 库,可以帮助移植一些 UI 类,但您可以必须重写大量的 UI 才能更好地处理鼠标/键盘/多窗口/菜单 GUI 环境。基本 NSObjects 以及一些 OpenGL 和 Quartz 图形渲染只需进行少量修改即可移植。

There exists an open source (BSD) UMEKit library that may help with porting a few UI classes, but you may have to rewrite a fair amount of the UI to better handle the mouse/keyboard/multi-window/menu GUI environment. Basic NSObjects, and some Open GL and Quartz graphics rendering, may port with only minor touch ups.

我们的影子 2024-10-17 08:20:07

正如其他人所说,移植可能是一件苦差事。不过,一般技术是有效的。您在 Interface Builder 中重新设计界面(如果适用)并检查不同控件的名称(CocoaTouch 仅具有典型桌面控件的一小部分)。 UI* 通常会变成 NS*。 Tableview 委托类似,因此可能很容易。

我必须像往常一样推荐 Aaron Hillegass 的书。这是对 Mac 开发的精彩介绍,了解 iOS 开发会给您带来优势。

既然是游戏,您可能需要考虑如何进行全屏模式。游戏不一定再占据整个屏幕,你不应该强迫它。现在需要一套全新的偏好。当然,现在有一些“乐趣”涉及到使用 Snow Leopard 处理分辨率列表/更改的新方法(以前的方法会向您发出弃用警告)。

只要接受可能会有一个漫长的过渡期,直到一切“喀嚓”一声:)

As others say, porting can be a chore. The general techniques work, though. You redesign the interface in Interface Builder (where applicable) and check what the different controls are called (CocoaTouch only has a small subset of typical desktop controls). UI* typically becomes NS*. Tableview delegation is similar, so it will probably be easy.

I'll have to recommend the Aaron Hillegass book as usual. It's a great introduction to Mac development, and knowing iOS development gives you an edge.

Since it's a game, you probably need to consider how to do fullscreen mode. The game doesn't necessarily take up the entire screen anymore, and you shouldn't force it. A whole new set of preferences will now be necessary. There is of course some "fun" involved now that there are new ways to handle resolution listing/changing with Snow Leopard (with the previous ways giving you deprecation warnings).

Just accept that there will be a possibly lengthy transition period until everything "clicks" :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文