I am busy creating a small note taking application but I have run into a bit of an issue.
I cannot seem to get an NSTextView to work with core data. I have watched this video https://www.youtube.com/watch?v=qypMqkT20LU and I have also read "Swift development with Cocoa".
"Swift development with Cocoa" uses an nstextview but they are not using core data. From the this book I have gathered that I need to use NSAttributedString for the content of the NSTextView.
The issue that I am having is that I cannot find out how to use that with Core Data.
I am trying to make this app like the video is so that I do not need to use any code but just use pure bindings.
I have also tried using binary data type for the attribute in my entity as well as transformable but then I get an issue where the application cannot start because it cannot find the applications saved data.
Any help would be much appreciated on how to use a NSTextView with core data and bindings.
It turns out that the storedata file that is created when the application launches was not being overwritten, so every time I changed and attribute in the storedata it would break because the attributes were not the same.
To fix this issue I had to delete the storedata every time I ran the app. The file can be found in /Users/{user}/Library/Application\ Support/{app name}
Usually the app name would be com.yourcompany.appname
Related
I started a document-based core data application targeting 10.9-only from the corresponding Xcode 5.1 template.
When the save-dialog is opened from the file-menu of my application, the user is presented with three file format options: Binary, SQLite, XML.
I don't want to give the user this choice but instead preset the file format to SQLite and no longer present the options in the save-dialog.
How can i achieve this?
Seems it is as easy as removing the XML and Binary entries from Document Types in my Application-Info.plist. Can anyone confirm this?
Currently I'm working on a product that uses the Cappuccino Framework and the Objective-J language.
I created my project using this command after installing Cappuccino: capp gen -t NibApplication Myapp
The Problem I'm facing is that I want to keep my code and GUI clean.
By doing so I wanted to split the GUI up in separate Xib / Cib (compiled version Cappuccino can read) and separate controllers, like I do with iOS and Mac apps.
I couldn't find on the internet or on the docs how to do so.
Also, all the examples (including the NibApplication template) contains only 1 xib file.
In short what I'm after is to load a controller, based on a XIB file which holds the window. All the outlets are connected to the controller I loaded.
Is there anyone who knows how to do it?
Thanks in advance and have a nice day!
The typical way to do this is to use a CPWindowController or a CPViewController for each xib you want to load. Here's what it might look like:
var myViewController = [[CPViewController alloc] initWithCibName:"mynib" bundle:[CPBundle mainBundle]];
This would load Resources/mynib.cib from your main bundle. Normally you'd also subclass CPViewController so as to give yourself a convenient spot for your control code.
Fixed it myself! I used this tutorial: http://vimeo.com/8948460
But instead of using atlas I used XCode. Just follow the steps but with XCode and you'll be fine if you want the above to happen.
I have a simple Mac app that I want to internationalize. I know how to use NSLocalizedString etc., and this seems very convenient and well thought out.
However, I also need to internationalize a .xib file in my project. I found this post about the process.
I tried it out, and it works, but strikes me as an extremely bad idea. Is there really no better way? What following the post produces is a bunch of copies of the .xib file, one for each language:
This works fine, until you decide to change an element in the interface, because then you have to go to each language, and change the element in every single one.
Is there a better way to internationalize the xib files?
You might want to use "base internationalization". It allows you to internationalize the strings without messing with the nib files.
However, it requires iOS 6, and it works best when used with Autolayout.
There is a section about base internationalizationin the handy Internationalize Your App Guide.
If you need to support iOS 5 you have to use your way. Or, as I prefer it, connect all UIViews to a IBOutlet and replace all texts in viewDidLoad.
I'm writing a Quicklook generator plugin for a GPS logging file format (.fit files). I've shoved something together which loads the file and plots the path using the NSGraphics/NSBezier stuff:
(the horrible code for the above can be found here)
This is fine, but it would be much nicer to display this over Google Maps data or similar (the recorded tracks cover a fairly small distance - e.g the above covers about 20km by 10km - too small to display on a single map of the earth, so the map needs to be dynamically loaded somehow)
Things I've tried so far:
Returning HTML which shows a Javascript GMap instance. Doesn't work as the Quicklook HTML rendering doesn't allow Javascript (or Flash, Java etc)
Returning HTML containing a static Google Maps image. Quicklook wont load remote images.
Getting a NSGraphicsContext and displaying a standard WebKitView into this, modified from some thumbnailing code - this errors because you cannot initialise WebKit from a secondary thread (which seems to work fine for thumbnails, but not previews?)
With 2. I could possibly download the static Google Map image in ObjC, then display that with HTML, but the static map isn't ideal (fixed size so no zooming, and potentially slow to initially load)
I came across MacMapKit which I've not tried yet, but since it's WebKit based, I suspect it will have the same issue as 3.
Is there some way of displaying a map in a Quicklook that I am overlooking?
trying to get Google data directly in your generator (whatever way you try to do it) is not possible as the host of your plug-in is sandboxed and denies any connection to the network
trying to return HTML data and some clever javascript won't work either as the Quick Look panel also protects against network access for security reason and there is no public way to work that around
I am afraid you won't find a real solution to your problem, except by using your own map data.
Still, your use case is interesting and you should file a bug to Apple's Bug Report website.
I am currently writing an application working with specially prepared image data. Another tool prepares the images (basically PNGs with additional data stored in the meta-data section). Now my tool works with these files, but not with all PNGs, so "we" decided to use a different file extension. So far, so good.
Now, because I am a lazy sack I implemented some file type registration to allow double-clicking on the file and opening it in my application (no problem at all).
And here is my Question:
It would be cool if the windows explorer could still show me the thumbnail previews for my files. Since they basically are still PNG files, it should be possible without writing my own shell extension (at least I believe so).
I quickly tried to copy all registry keys and values from HKCR.png to HKCR.mInDat (my file name ext) and it worked. However, I would prefere knowning what I am doing ;-)
Which of the registry settings are responsible for the thumbnail preview control and which can I use to get the preview for my file types?
I tried to google it, but I failed, since it seems I am unable to come up with the right buzz-words to find the info I need. Please, help me.
Thank you!
Yours,
3of4
Simple:
[HKEY_CLASSES_ROOT\.apng]
#="apng"
"Content Type"="image/png"
"PerceivedType"="image"
[HKEY_CLASSES_ROOT\apng\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
#="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"