开发者

How to make an NSMenu recent list

I'm working on a small URL shortening application for someone, and I need to have a list, similar to that of Droplr's, that has all of the recently shortened URLs. The list should be a submenu of the main menu, which is attached to an NSStatusItem.

I need to have that list add an item each time a URL is shortened, and I'd like to have a notification come up with the link in it when clicked. The list should have no more than about ten recent URLs.

I also need to have a way to store the list so that it will come up when the app is started again. I don't think it would be a good idea to use Core Data for it, but I'm not sure of what I sh开发者_运维问答ould use.


I need to have that list add an item each time a URL is shortened, …

You definitely should do that.

… and I'd like to have a notification come up with the link in it when clicked.

As long as the notification says “Copied [short URL] to the clipboard”, since the notification wouldn't be useful otherwise.

The list should have no more than about ten recent URLs.

Sounds good. You could make this configurable in a Preferences panel.

I also need to have a way to store the list so that it will come up when the app is started again.

I agree.

I don't think it would be a good idea to use Core Data for it, but I'm not sure of what I should use.

Core Data may be overkill, but it could work. The other way would be to store it in a plist file, using NSPropertyListSerialization to convert your array of (completely custom) model objects to plist data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜