Re: NSDocument
On 15/01/2010, at 5:57 AM, David Blanton wrote: I need awakeFromNib to be called for any instance on my NSDocument sublass. This isn't an answer to your question, but I believe generally you should be using the -windowControllerDidLoadNib: method of NSDocument instead of -awakeFromNib if you are not using a separate NSWindowController. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: If Array Controller is empty, how to populate pop-up list?
On 15/01/2010, at 1:18 PM, Jenny M wrote: However, message #1 still stands - how do I implement a placeholder object only when the array is empty?? In your content binding for the popup button in Interface Builder, check the Inserts Null Placeholder checkbox and enter a value in the Null Placeholder field. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: If Array Controller is empty, how to populate pop-up list?
On 15/01/2010, at 4:24 PM, Jenny M wrote: Like I mentioned previously - when I do that, it stays there even after an object has been added, which is not what I'm aiming for. I only want it to appear when empty. Ah, sorry, I didn't see that in your original post. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CGImageCreate performance
On 08/01/2010, at 11:36 AM, David Blanton wrote: The performance issue comes from the fact the user will be dragging this bitmap around so I a regenerating m_bitmap.m_array constantly. I'm not sure what your app does, but have you considered using a Core Animation layer to host the bitmap? That way you can move the image around willy-nilly with virtually zero cost, and you only have to regenerate the bitmap if it changes. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings blues
On 07/01/2010, at 12:35 AM, jonat...@mugginsoft.com wrote: Okay, so its a bug, or an issue. Its just the fact that every app seems to end up binding on the bindiings. I like the view controller bindings but I hate fighting with them. There is more coding with a data source but performance seems much more predictable for larger data sets. I've fought this problem too, it's a regression in 10.6 as the problems don't exist under 10.5. It occurs when you have a lot of bindings and a lot of objects being tracked by the controller. Please file a bug report and refer to my bug number 7139579. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Looking tutorials or blogs on NSOutlineView NSTreeController . . .
On 07/01/2010, at 8:52 AM, Michael A. Crawford wrote: Never used this view/control before. I'm looking for resources to help me shorten the curve, especially when used with the NSTreeController. I'm also considering switching my model to CoreData. Currently I have some code working that uses neither CoreData nor NSTreeController and I wondering if I should stick with it or switch. I'd personally highly recommend avoiding NSTreeController for anything other than trivial usage. It has a lot of problems, especially when used with Core Data. However, here's some Apple Sample Code: http://developer.apple.com/mac/library/samplecode/AbstractTree/ and there's quite a few hits here... http://www.google.com/search?q=nstreecontroller+core+data -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSEvent timestamp is zero
On 07/01/2010, at 10:47 AM, jonat...@mugginsoft.com wrote: I am trying to filter my NSEvents by timestamp but some, with event type of NSAppKItDefined, have a zero timestamp. I can work around this by calculating a timestamp value for the event as the current time since system boot. Is a mach timer the way to go on this? What are you actually trying to do? Why do you need to filter the events by timestamp? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: help system structure
On 07/01/2010, at 3:24 PM, Shane wrote: I was trying to follow this link on Organizing the Help Book Bundle but I'm a bit confused on whether I should create the 'Contents' and 'Resources' folder or what goes where. http://developer.apple.com/mac/library/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/authoring_help/authoring_help_book.html I do have the English.lproj folder, but not in the same way the link above shows. I also have many *.nibs in my English.lproj folder, so can I just create a help folder there to separate help files? You need to create the help book bundle in your built application's Resources folder. It sounds like you may not be aware that a built application is actually a folder (bundle) with a specific structure. If that's the case, you should read this first: http://developer.apple.com/mac/library/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html Xcode creates a Copy Bundle Resources build phase for your target by default when you use any of the Cocoa Application Templates. Any files/folders in the Copy Bundle Resources build phase are copied into your application's Resources folder when you build the app. So, to create the help bundle, just create a folder with the structure for the help book as described in the documentation and put it in your project folder with your other files. You then tell Xcode about it by dragging it into the Groups and Files pane for your project. However, because you want Xcode to copy the folder you must use the Create folder references for any added folders when Xcode asks you what you want to do with the file, otherwise your folder won't be treated as a file and won't be copied to your app on build. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Getting warning when saving merged MOC
On 05/01/2010, at 5:35 PM, Rick Mann wrote: Am I doing something wrong, or failing to take some step to avoid this confusion? There may be legitimate changes in MOC A that need to be saved, but the merged changes should already be in the store. When doing things like this that you don't want the undo manager to pick up on, you just need to disable undo while you perform the operation, making sure you flush changes before re-enabling it: [moc processPendingChanges]; [[moc undoManager] disableUndoRegistration]; //do some stuff that alters the moc [moc processPendingChanges]; [[moc undoManager] enableUndoRegistration]; -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird issue with BDAlias/FSRefs and the case of filesystem paths
On 06/01/2010, at 6:18 AM, Kyle Sluder wrote: If the directory is on a case-insensitive HFS volume (the default), Yes, it is. It will also be helpful to see what the value of $HOME is, and if it jives with the on-disk name. echo $HOME /Users/rob This is really, really weird. I've since rebuilt the directory with Diskwarrior with no change to the behaviour. On the other machines here everything's working so it must be something unique to my setup but I have absolutely no idea where to start looking. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird issue with BDAlias/FSRefs and the case of filesystem paths
On 06/01/2010, at 10:29 AM, Rob Keniger wrote: This is really, really weird. I've since rebuilt the directory with Diskwarrior with no change to the behaviour. On the other machines here everything's working so it must be something unique to my setup but I have absolutely no idea where to start looking. OK, so I took the brute force approach. I booted into single-user mode and did this: mv Users Lusers mv Lusers Users Now everything's fine. Nothing to see here, sorry for the waste of bandwidth. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Path comparison and case sensitivity
My recent troubles with filesystem case got me thinking. Should Cocoa applications always assume that the filesystem is case-insensitive when comparing path strings? Surely this could lead to problems if the user has formatted a volume with a case-sensitive file system? Is there any way to know whether or not a file is on a case-sensitive volume? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Path comparison and case sensitivity
On 06/01/2010, at 3:39 PM, Ken Thomases wrote: Don't compare paths. Use APIs like FSCompareFSRefs() or call -[NSFileManager attributesOfItemAtPath:error:] and compare the NSFileDeviceIdentifier and NSFileSystemFileNumber keys (this is the Cocoa equivalent of calling stat(2) and comparing st_dev and st_ino). Many thanks for this info, I will immediately switch my code across to use this as it's definitely more robust. Is there any way to know whether or not a file is on a case-sensitive volume? A couple of ways (there are others): On 10.6 and later, see NSURL's new resource-values APIs and NSURLVolumeSupportsCaseSensitiveNamesKey. On 10.3 and later, see getattrlist and VOL_CAP_FMT_CASE_SENSITIVE. Thanks for the pointer. I guess if I'm using the aforementioned APIs to compare files then I won't need to worry about the case sensitivity of the file system anyway, though. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Weird issue with BDAlias/FSRefs and the case of filesystem paths
Hi everyone, I'm using the BDAlias wrapper (http://github.com/rentzsch/bdalias) for handling alias records so that my app manages files better when they're moved or renamed. Things were working fine but recently, for no apparent reason, any alias that points to a file in the Users folder returns a lowercase users filename for the Users folder rather than the normal Users. This means that my paths look like this: /users/rob/some/file.html rather than this: /Users/rob/some/file.html If I use any of the Cocoa methods to select a file such as NSOpenPanel, or just print NSHomeDirectory(), I get the correct result, Users. In the Finder and when using Terminal, the folder is named Users. From what I can tell there are no extended attributes on the Users folder, running xattr -l -v /Users returns nothing. I've looked at the BDAlias code and it's pretty straightforward, it is just getting a CFURLRef from the path and then grabbing the FSRef from the URL, something like this: FSRef *outRef; CFURLReftempURL = NULL; Boolean gotRef = false; tempURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inPath, kCFURLPOSIXPathStyle, false); if (tempURL == NULL) return fnfErr; gotRef = CFURLGetFSRef(tempURL, outRef); When the BDAlias object is asked for its path it does the reverse, and gets the path from the FSRef via a CFURL: CFURLCreateFromFSRef(kCFAllocatorDefault, inRef); if (tempURL == NULL) return NULL; CFStringRef result = CFURLCopyFileSystemPath(tempURL, kCFURLPOSIXPathStyle); This all seems fine, and the only things I can think of is that there is some weird bug in CoreFoundation that's causing this or that my drive is corrupted in some weird fashion, although Disk Utility reports no problems. Interestingly, on my system other apps such as BBEdit and Coda also exhibit this behaviour. In BBEdit for example, if I choose Edit Insert File/Folder Paths then I get /users/rob/some/file.html. I assume that's because it's also using FSRefs internally. I don't understand what could be happening here, does anyone have any clues? I've never seen anything like this. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBezierPath linewidth not correct
On 02/01/2010, at 8:58 PM, Gustavo Pizano wrote: No worries, I modify it and in fact it does work, but the background images will display a .5 gap between along the horizon between the images that conform the background, so I will put just a .5 to everywhere I need instead... It will probably be easier to create an NSAffineTransform and translate the whole context by 0.5px, so all drawing is offset without you needing to fiddle with individual values. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom NSWindow drawing
On 02/01/2010, at 7:04 AM, PCWiz wrote: Is there a simple way to do this? Do I have to draw the entire window by hand (bottom bar and all) ? Or can I slightly modify the existing NSWindow layout to just draw that arrow at the top? Thanks You could possibly fake the title bar by using a second child window that overlays the top section of the window and draws just the arrow. Otherwise, you'd need to draw the whole thing yourself. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Creating CoreData classes
On 28/12/2009, at 2:52 PM, Brian Bruinewoud wrote: But I'm looking for something more like this: CDClass *cdObject = [ CDClass insertNewObjectInManagedObjectContext: context ]; Is there any such method or do I need to add them to the generated class files myself? If you use mogenerator to create your custom NSManagedObject subclasses, you get methods like this created for you automatically: http://github.com/rentzsch/mogenerator -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: n00b Q re: AppController
On 25/12/2009, at 10:00 AM, David Duncan wrote: In Objective-C all classes share a namespace, so if two binary images are loaded into the same address space, and use the same class name, then one of the two classes will be used. If all of these AppControllers share the same functionality, then you probably won't have any issues (for now) but if all of your plugins do implement this class to the same function, then you should probably abstract them all into a common framework that all of these plugins load instead. ...or at the very least, change the class names of the AppController classes in each plug-in so they don't have the same name. AppController is a poor name for the main class of a plug-in anyway, as it is nothing of the sort. BurnerController and ProducerController would be possibilities in this case. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: storing ivars in core data docs
On 23/12/2009, at 9:18 PM, Quincey Morris wrote: What's a doc? Seriously, are you talking about a file, or a NSPersistentDocument subclass instance, or what? If you're asking Is it possible to archive arbitrary values as raw binary data or perhaps using the NSKeyedArchiver mechanism in a persistent store alongside but not within the Core Data database? then the answer is no. You have to implement persistent storage for a value kept in a regular ivar as a property of some Core Data entity using the techniques described in the Core Data documentation. That's not 100% true, you can store an NSFileWrapper that contains a Core Data store as well as other files, so you can store whatever data you like. See this sample code for an example: http://developer.apple.com/mac/library/samplecode/PersistentDocumentFileWrappers/ It's not perfect but it certainly works. For the OP, as Quincey pointed out, your question is not clear. What are you trying to do? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Menu items unexpectedly disabled
On 19/12/2009, at 6:50 AM, Todd Heberlein wrote: I have a document-based app. For each document there can be a couple of satellite windows brought up for specific views of some of the data. Each of these satellite windows is controlled by an NSWindowController subclass loaded by MyDocument and added via addWindowController:. A menu item's target is the First Responder, and the method to implement the action is in MyDocument. Everything works as expected when the primary window is key. The problem is that when one of the satellite windows is key, menu items implemented by MyDocument are disabled. I thought the responder chain went through the NSWindowController and then through to its NSDocument? Or is this only the case when for the document's primary window (and NSWindowController)? That's correct, and that's how it should work. It works here in a test app. Are you doing anything unusual in your NSWindowController? What methods are you overriding? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CoreVideo101 Error when porting to new Cocoa project
On 18/12/2009, at 10:41 AM, Travis Kirton wrote: In XCode I've started a new project, as a cocoa application (i.e. appdelegate) and copied the headers / files, adapted a new XIB file to mirror the one available in the tutorial project... Have you added the required frameworks to your target? I'd say you need to add both the Quicktime and OpenGL frameworks for this code to compile. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On 17/12/2009, at 9:39 AM, Melissa J. Turner wrote: I think you're running into a known problem with the binary store not respecting the value transformer name and instead always using the default archiver (NSKeyedArchiver). AHA! I didn't realise that this was a known bug, I've had a question open on stackoverflow for about a month on this one: http://stackoverflow.com/questions/1598600/ I thought it was just me being dense. Thanks for the info. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Crash after Fix
On 17/12/2009, at 2:27 AM, Gideon King wrote: Hi all, I have a strange issue - I have a program that is running quite happily, and when I make a change to it and click the Fix button, it fixes the issue, but then I immediately get an exc_bad_access error when I continue running it. The stack trace shows a doesNotRecognizeSelector error. It always happens in the same place in my code, and the method does exist (it is in a category, and the method where it is being called from is in the same category). I have tried a complete clean and rebuild, but to no avail. In my experience, Fix and Continue is unreliable at best. I never use it. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bluetooth failure
On 12/12/2009, at 11:24 PM, Alexander Spohr wrote: As far as I know, the Simulator has no GameKit as it does not exist under Mac OS. That's actually not quite true, GameKit exists on the simulator but it (very unfortunately) cannot use the Mac's Bluetooth hardware, so it's not very useful. So this can not work. Therefore your problem is not the iPod but the Mac. You need two iPhones/iPods to do GameKit tests. This is true, however. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBezierPath vs. NSImage
On 11/12/2009, at 8:59 PM, Alastair Houghton wrote: Anyway, the thing to do is to draw what you want, and then *if* it's going too slowly there are various things you can do to speed it up (like caching any expensive rendering in an NSImage, doing reduced or simplified rendering during live resize and so on). It's also worth considering looking at Core Animation Layers, depending on what you're drawing. I have a custom view with several objects that are expensive to draw, and what I am now doing is drawing them into CALayers. Because these are cached to the GPU, there is virtually no cost to dragging the objects around as the only time they need to be redrawn is when the content of the objects changes. Since my objects are overlaid on a large image background (at least 1000 x 1000), drawing was very expensive before I did this as the image needed to be redrawn any time the view content changed. With CALayers it is only drawn once. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Leopard for development / testing.
On 10/12/2009, at 2:58 PM, Dan Ribe wrote: I already have snow leopard developer tools for it. So basically I can develop application using it on snow leopard for both 10.5 10.6. I am looking for a copy of Leopard so that I can test my software on Leopard as well. thanks This question is not Cocoa-related and should be asked elsewhere. You have two options: 1) find a copy somewhere and buy it (eBay etc) 2) buy a developer membership from Apple. The Select and Premier memberships allow you to download all releases of Mac OS X back to Jaguar (10.2). The developer membership also gives you access to Apple's testing labs, if you are close to the locations. You'd need to ensure that your machine supports booting in Leopard, if your Mac shipped with Snow Leopard it probably won't boot in Leopard. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Big memory/time consumption in NSTreeController KVO GC
On 09/12/2009, at 7:35 AM, Greg Parker wrote: Which OS version is this? 10.6.2 fixed a performance problem with garbage collection and large KVO populations. If you still have trouble in 10.6.2+ then you should file a bug report. There are still massive remaining performance issues with NSTreeController/NSArrayController in 10.6 if you have a large number of active bindings. Please see my bug report rdar://7139579 which includes a simple sample project. The performance on Snow Leopard is orders of magnitude slower than in 10.5. All of the problems seem to relate to the private class NSConcretePointerArray and something that it's doing with weak references. That seems to be involved in Benjamin's case and it is definitely the problem in our case based on Shark traces. Specifically, the routines auto_read_weak_reference(), readWeakAt() and objc_read_weak() that appear to be involved in the the -compact method of NSConcretePointerArray are taking up an inordinate amount of CPU time. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Customize the line's color that separates the window content from the title bar?
On 09/12/2009, at 5:59 AM, Michael Abendroth wrote: Unfortunately, when turning on the textured flag in IB, my app mysteriously crashes. When you say mysteriously, what do you mean? What is the stack backtrace? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A hillegass challenge
On 04/12/2009, at 5:55 PM, Seth Willits wrote: My question pertains to knowingly setting an object to NULL and then knowingly sending it a message as an acceptable technique. As general answer: Yep. Happens all the time. As Seth points out, this is perfectly normal. However, you should generally use nil instead of NULL for nil objects in Objective-C. It doesn't matter from a technical point of view (they're both the same) but it's the accepted coding style. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Text insertion point not blinking
On 04/12/2009, at 3:17 AM, Gideon King wrote: I have a text view which has the drawsBackground: set to NO, and now the insertion point is not blinking - it's just a solid line. If I turn the drawsBackground: on, it does blink as expected. Any suggestions as to why this could be happening? It's possible you might need to subclass NSTextView and return NO from -isOpaque, that's bitten me a few times when subclassing Apple controls. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Text insertion point not blinking
On 04/12/2009, at 12:51 PM, Gideon King wrote: Thanks for the suggestion, but that made no difference. Weird. Is this a custom subclass of NSTextView or a vanilla one? If I create a new project, drag a text view into a window and turn off Draws Background for the scroll view and text view, the cursor displays normally. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Use of preprocessor macros
On 02/12/2009, at 10:59 AM, Graham Cox wrote: I'm defining a preprocessor macro in the 'GCC 4.2 - Preprocessing / preprocessor macros' section of my project's build properties, e.g. foo=1. This is set only in the debug version. But when I try and use it in the source code, as in #if foo ... #endif I get 'foo is not defined'. What should I be doing? I need to conditionally compile in some code in the debug version and leave it out in the release version. This works fine for me. Are you sure you are compiling the build configuration you think you're compiling? Are you changing the preprocessor setting on the right target? Probably worth double checking. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Use of preprocessor macros
On 02/12/2009, at 11:35 AM, Graham Cox wrote: To be honest it's very confusing as to which settings you're supposed to use for what, and where they apply, since they're all identical. If the project settings are not used, why have them there at all? The project settings apply to all targets, but you can override them in individual targets. I agree that it can be confusing where certain settings are located, especially if you have multiple targets. If you have changed a target's settings but want a target to inherit the project settings for a particular option, you can highlight the option and then choose delete definition at this level from the action popup in the bottom-left of the window. This is probably drifting off into Xcode-users territory now though... -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hiding String Constant in Compiled Code
On 01/12/2009, at 4:05 AM, Richard Somers wrote: I could be wrong but I do not think this is the case. The documentation states Once you have signed your code, any change in the code that you did not intend—whether introduced accidently or by hackers—can be detected by the system. No where does it say the system will not run the altered code. Launchd will terminate the application on launch if a change is detected, provided you sign the application with the -kill flag. However, as Jens points out, this is not a solution. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to remove all objects from a NSTreeController ?
On 26/11/2009, at 11:27 PM, Sébastien Stormacq wrote: I am developing an Cocoa application using a NSTreeView, bound to a NSTreeController. The application is build around a master-detail structure, with an NSOutlineView on the left side and a NSTableView on the right side (similar to iTunes) I would like to remove all elements from the detail table when the user changes selection in the Outline View before adding new elements, fair enough :-) ? You don't need to do this. Just create an NSArrayController for your NSTableView that is bound to the selection key of the NSTreeController. The NSArrayController will then populate the table view for you. If you need to manually manage the objects that are in the table view then you may need to use a datasource for the table view rather than an NSArrayController. Your datasource can use KVO to observe the selection key of the NSTreeController and update the table view as appropriate. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to remove all objects from a NSTreeController ?
On 27/11/2009, at 4:26 PM, Sébastien Stormacq wrote: You don't need to do this. Just create an NSArrayController for your NSTableView that is bound to the selection key of the NSTreeController. The NSArrayController will then populate the table view for you. I am binding to arrangedObjects of the NSArrayController Yes, you bind the content of the table view to the array controller, but you should bind the content of the NSArrayController to the selection key of the NSTreeController. What is the content binding of the array controller currently set to? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Inactivity Timer
On 25/11/2009, at 8:37 AM, Kevin wrote: I needed to implement an inactivity timer in my Cocoa App and did so my subclassing NSApplication and overriding sendEvent: to start and stop a timer. Although it works most of the time, every once in a while my timer gets fired as I'm typing text into a text field or interacting with some other control like scrolling a table view. You might want to look at Uli Kusterer's UKIdleTimer, which is a Cocoa wrapper around the Carbon EventLoopIdleTimer, which is a system-provided timer that only fires when the machine has been idle for a specified amount of time: http://www.zathras.de/angelweb/sourcecode.htm#UKIdleTimer -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa Bindings and NSUserDefaults
On 25/11/2009, at 12:17 PM, Ben Haller wrote: - There's a little bit of duplication of information between the nib and the code. The tags on the radio button matrix's cells have to match the values in the enumeration, for one thing. Even more annoyingly, the strings for the defaults keys have to correspond to the bindings key paths I enter in IB. This duplication seems like a vulnerability (not that it wouldn't also be there without using bindings, of course). There isn't any reasonable way to get rid of this, is there? Unfortunately not. Key paths are just strings and you can't use symbolic constants in Interface Builder, you have to use the string itself. Yes, it's fragile. - A little bit of glue code still seems to be necessary (or at least aesthetic) to vend the user defaults to client code (i.e. the +launchAction, +sgeHeadNode, etc. class methods). I could get rid of them, but then I'd have to export the defaults keys in the header, and every client of the preferences would have to do the same thing as this glue code themselves, so the current way seems preferable (no pun intended :-). Am I missing a way to make this code nicer, or will I have to add a glue method like this every time I add a defaults key? When you retrieve and initialize the values you can just use regular user defaults, you don't have to use the NSUserDefaultsController. The user defaults controller that you use in bindings just pipes the values directly into NSUserDefaults so unless you need the additional functionality of the user defaults controller in your code you can ignore it. + (void)initialize { NSDictionary *defaults = [NSDictionary dictionaryWithObjectsAndKeys: @my.server.com, akSGEHeadNodeKey, @username, akSGEUsernameKey, @password, akSGEPasswordKey, [NSNumber numberWithInt:akLaunchShowNewSimulationPanel], akLaunchActionKey, nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; } + (AKLaunchAction)launchAction { return (AKLaunchAction)[[[NSUserDefaults standardUserDefaults] objectForKey:akLaunchActionKey] intValue]; } -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with multiple instances of a nib
On 23/11/2009, at 8:32 AM, Ben Haller wrote: This same thing has been biting me. The problem is, I am guessing, that nothing in your code keeps a strong reference to your controller. Making a window with a controller creates an isolated group of objects that are not referenced from the outside, so they are collected when the collector gets around to it. This is exactly correct. Unless there is something holding onto the window controller, it will be eligible for collection as soon as scope leaves the method that created it. What I usually do is create an ivar to hold onto the window controller until such time as I want to manually release it: @interface SomeClass : NSObject { ImagePanelController *ctrl; } @end @implementation SomeClass - (IBAction)newImagePanelForImage:(NSImage*)aImage { ctrl = [[ImagePanelController alloc] init]; [NSBundle loadNibNamed:@ImagePanel owner:ctrl]; [ctrl setImage:aImage]; } @end Note that in the original code the ImagePanelController instance was autoreleased. This will do nothing when GC is enabled, but in this case would ensure that the same problem occurs under non-GC mode, i.e. the controller will be autoreleased as soon as the pool is drained. Also, note that this is not the normal way for a NSWindowController to operate. NSWindowController knows how to load a nib properly, so you should set up the -init method of ImagePanelController like so: @implementation ImagePanelController - (id)init { self = [super initWithWindowNibName:@ImagePanel]; if(self) { //do some initialization } return self; } @end That way, you can write the newImagePanelForImage: method like this: - (IBAction)newImagePanelForImage:(NSImage*)aImage { ctrl = [[ImagePanelController alloc] init]; [ctrl setImage:aImage]; } The window controller handles all the nib loading machinery itself. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with multiple instances of a nib
On 23/11/2009, at 8:49 AM, PCWiz wrote: Good to know that I'm not the only one experiencing this. The easiest solution I guess is to keep an array of the controller objects, which I will try. Is this how you mean: NSMutableArray *controllerObjects = [[NSMutableArray alloc] init]; ImagePanelController *newController = [[[ImagePanelController alloc] init] autorelease]; [controllerObjects addObject:newController]; With this method, when the panel is closed would the controller be removed from the array (I'm guessing not, and if so, how would I make it do that?) Register the object that manages the array as a delegate of the window, implement -windowWillClose: and remove the appropriate window controller from the array? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with multiple instances of a nib
On 23/11/2009, at 11:42 AM, PCWiz wrote: First of all, you would need to keep a reference to the controller object inside the panel itself. I'm not sure if there is a cleaner way to do it, but I found that subclassing your panel and then adding a property to keep a reference to the controller worked. Like this: You don't need to do this, it violates MVC. Just loop through the controllers and remove the one that is controlling the window: - (void)windowWillClose:(NSNotification *)aNotification { NSWindow *panel = [aNotification object]; NSWindowController* controllerToRemove = nil; for(NSWindowController* currentCntl in controllers) { if([[currentCntl window] isEqual:panel]) { controllerToRemove = currentCntl; break; } } [controllers removeObject:controllerToRemove]; } -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController content array bindings
On 23/11/2009, at 1:20 PM, Mazen M. Abdel-Rahman wrote: In the bindings inspector of Interface Builder I bind to file's owner - which in my case is a subclass of NSWindowController, and set the model key path the the name of the NSMutableArray I want to bind to. This does not seem to be working. What binding are you using in Interface Builder? You should be using the Content Array binding. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Advice about crash requested
On 20/11/2009, at 10:54 AM, Jens Alfke wrote: Turning on NSZombieEnabled might help shed some light on this. There's a So, You've Crashed In objc_msgsend FAQ out there on teh interwebz somewhere that goes into more detail on troubleshooting. I didn't think you could use NSZombieEnabled for GC apps. Can you? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to avoid text distortion
On 20/11/2009, at 3:23 PM, padmakumar wrote: One more point is that I am using Xcode 3.2 in Snow Leopard (Version 10.6.2) and in System Preference - Appearence - Use LCD font smoothing when available option is disabled , again font and text are displayed perfectly ie with out any distortion. If I enable this option which is enabled by default this problem occurs. But this problem happens only with the application I have developed. I suspect you are using a layer-backed view. NSTextFields with no background color will display without sub-pixel anti-aliasing on layer-backed views. If you want the text to have sub-pixel anti-aliasing, give the text field a background color. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: What exactly does NSController do?
On 19/11/2009, at 11:44 AM, Chase Meadors wrote: However, my question becomes more strange, as now I have many working bindings systems in my code without any NSControllers. Binding to plain old NSObjects seems to be fine. What is the purpose of NSController? NSObjectController and friends conform to the NSEditor informal protocol, which means they correctly handle -commitEditing and -discardEditing messages, which binding directly to an object doesn't do. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSUndoManager and runModalForWindow: (again)
On 17/11/2009, at 12:41 PM, Kevin wrote: After some more experimenting: It works for the first few edits after which the behavior reverts to undo/redo in bunches. And you're right, I shouldn't have to do setGroupsByEvent:NO when in fact it's the opposite of what I want. In short, this remains an issue. I'm perplexed as to why the undo manager behaves this way. I've read the docs over and over again and aside from setRunLoopModes: method, which I'm calling with NSModalPanelRunLoopMode, there's no mention of any special considerations when using it with modal windows. If you have a paid dev membership, now might be the time to use a support incident I think. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Example of categorized lists in a Mail-type interface
On 16/11/2009, at 4:38 AM, Ian Piper wrote: I would appreciate it if someone could point me at an example that I could use as the basis for building a categorized list similar to the mail folders display in Mail. This should help: http://developer.apple.com/mac/library/samplecode/SourceView -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
On 15/11/2009, at 11:48 AM, Sandro Noël wrote: But where are the ones from apple... that's what i'm wondering, Why do we have to duplicate work that evidently has already been done. I'm confused as why apple is not including it in it's development tools. it makes no sense to me... There's nothing you can do except file a bug report. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom window not getting a shadow
On 10/11/2009, at 9:51 PM, Ken Tozier wrote: I'm writing a custom window class and am finding that even though I set the hasShadow property to YES, it isn't getting one. I stripped the following example down to the bare esentials but still no shadow. Anyone know why this might be happening? Does the window have the shadow option enabled when you inspect it in Interface Builder? You might want to try setting the shadow in -awakeFromNib. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBitmapImageRepresentation image generation and saving resulting in image with much noise
On 09/11/2009, at 7:28 PM, Michael Robinson wrote: I'm getting images with a lot of noise in them, I was wondering if anyone has any ideas why this would be? I've attached a screenshot of the noisy images I've been getting. The shot is of four images that well shouldn't have any noise at all. An NSBitmapImageRep is not guaranteed to be empty when you create it and in general it's just full of random bits. You need to clear it explicitly if you are drawing non-opaque content: void ClearBitmapImageRep(NSBitmapImageRep* bitmap) { unsigned char* bitmapData = [bitmap bitmapData]; if (bitmapData != NULL) { bzero(bitmapData, [bitmap bytesPerRow] * [bitmap pixelsHigh]); } } -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: avoiding spagetti code
On 10/11/2009, at 8:04 AM, Oftenwrong Soong wrote: In the MVC style, I want to avoid connecting directly between a view and a model. However I have a custom NSView subclass that renders a graphical view of the model and therefore it needs information from the model. I think it is considered bad practice to put a pointer to the model directly in my NSView subclass. However how can this type of coupling be avoided if the view needs the information? I struggled with this for a while, but you just need to look at some of the built-in complex views to see how this can be done. In particular, have a look at the datasource and delegate methods for NSTableView, for instance. The view publishes protocols which a controller object can use to control how the view is displayed. You can do exactly the same thing for your own custom view. You use the controller object to supply the view with the information that it needs to be able to draw representations of your model objects. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: code data export import strategies
On 09/11/2009, at 5:03 PM, Martin Hewitson wrote: Thanks, Rob. I do have this book, but I sort of skipped the section about multithreading (where the export example is buried), but I've found it now. Yes, it's kind of a shame that it's buried in there. I initially skipped it too. In my case I don't need to use multithreading and it was easy to adapt the code to a non-threaded implementation. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: code data export import strategies
On 09/11/2009, at 5:18 AM, Martin Hewitson wrote: I've been digging around for export and import strategies to allow me to export parts of a core data model. In more detail, I have a set of categories, each of which contains a set of meetings. Each meeting has a fairly complex object graph below it (agenda, agenda items, location, title, etc). I want to allow the user to export a meeting which can then be imported by someone else using the same application. Does anyone have any good advice how best to approach this? I was considering making the NSManagedObject subclasses conform to NSCoding, but I read in a couple of places that this was difficult to do, particularly the initWithCoder: part. Anyone tried this already? Yes, I've done this. What I did is create a second NSManagedContext with a separate NSPersistentStore and copy the relevant objects out of the main NSManagedContext into the new one. You basically do the reverse on import. There is an excellent example of how to handle import and export in Marcus Zarra's Core Data book: http://pragprog.com/titles/mzcd/core-data I highly recommend getting a copy if you're working with Core Data. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController, Core Data and root objects
On 06/11/2009, at 5:38 AM, Fritz Anderson wrote: Here is what I did, for a small tree: My document keeps the root object as a KVO property -- I do not rely on a fetch. I declare classes for my tree-element entities. so I could implement a method, -(NSArray *)orderedChildren, to return the children set, sorted as needed. I exposed the document (and thus, indirectly, the root) through an NSObjectController. I bound the tree controller's content _array_ to that root object's orderedChildren key. (Document NSObjectController - root.orderedChildren). Members of the content array appear as top-level nodes in the outline. My tree has constant structure, so I can't make any comment on mutation. Hi Fritz, Thanks for this pointer. Unfortunately, while this works great for a static tree, it fails when you try to mutate the tree objects. :-/ -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController, Core Data and root objects
On 06/11/2009, at 7:35 AM, Steve Steinitz wrote: Fritz's idea looks much cooler (I might try it) but for a clumsier solution, have you written your own method to add new top-level items? I wonder if an IBAction like this would work: - (IBAction) addVisibleTopLevelItem: sender { YourEntity *invisibleTop = [self topObject]; YourEntity *newVisibleTop = [NSEntityDescription insertNewObjectForEntityForName: @YourEntity inManagedObjectContext: [context]]; [newVisibleTop setParent: invisibleTop];// does your entity have a setParent? // might also need to add a child to inVisibleTop [treeController addObject: newVisibleTop]; [treeController rearrangeObjects]; // needed? } Something along similar lines seems to work for me. Thanks. What I've tried, which does seem to work, is overriding -insertObject:atArrangedObjectIndexPath: and setting the parent explictly if the item is being inserted at the top level: - (void)insertObject:(id)object atArrangedObjectIndexPath:(NSIndexPath *)indexPath { NodeObject* item = (NodeObject*)object; //only add the parent if this item is at the top level of the tree in the outline view if([indexPath length] == 1) { //fetch the root item NSEntityDescription* entity = [NSEntityDescription entityForName:@NodeObject inManagedObjectContext:[self managedObjectContext]]; NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init]; //I'm using GC so this is not a leak [fetchRequest setEntity:entity]; NSPredicate* predicate = [NSPredicate predicateWithFormat:@isRootItem == 1]; [fetchRequest setPredicate:predicate]; NSError* error; NSArray* managedObjects = [[self managedObjectContext] executeFetchRequest:fetchRequest error:error]; if(!managedObjects) { [NSException raise:@MyException format:@Error occurred during fetch: %@,error]; } NodeObject* rootItem = nil; if([managedObjects count]) { rootItem = [managedObjects objectAtIndex:0]; } //set the item's parent to be the root item item.parent = rootItem; } [super insertObject:object atArrangedObjectIndexPath:indexPath]; //this method just sorts the child objects in the tree so they maintain their order [self updateSortOrderOfModelObjects]; } Can anyone see anything wrong with this? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTreeController, Core Data and root objects
On 06/11/2009, at 4:15 PM, Steve Steinitz wrote: I don't see anything wrong. In fact, it looks great. Does insertObjects:: call insertObject:: so that one day, if you implement drag and drop for multiple items it will all work? Good question, I haven't tested that but I will do so. One possible tweak: since you've already subclassed NSTreeController would be worth overriding its awakeFromNib to cache the root object? Is the root object unchanging? Then insertObject:: would be short and sweet. The root object is indeed unchanging. You're right, caching the object would be an improvement on the fetch. I'll proceed with this and see if I have any problems. Many thanks, -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatic Binding KVC KVO
On 05/11/2009, at 8:42 AM, Richard Somers wrote: See mmalc’s Graphics Bindings sample: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Sometimes Cocoa can be overwhelming. This will help. Thank you so much. :) You might also find this blog post very helpful: http://www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTreeController, Core Data and root objects
Hi everyone, I have a Core Data model which consists of a simple tree of a particular entity, which has two relationships, parent and children. I have an NSTreeController managing the model, with an NSOutlineView bound to the NSTreeController. This works fine if I set the fetch predicate of the NSTreeController in Interface Builder to parent == nil. My problem is that I need a single root object, but this should not display in the outline view, only its children should be displayed at the top level of the outline view. My entity has an attribute, isRootItem, that is true for the root item only. For instance, my model looks like this: Node 1 | +- Node 2 | Node 3 | | | +- Node 5 | Node 4 I need to display Nodes 2, 3 and 4 at the top level of the outline view, but still have their parent be Node 1. Node 1 has a value of YES for isRootItem and all the others have NO. If I set the fetch predicate of the tree controller to parent.isRootItem == 1, this displays the tree correctly, but as soon as I add a new item to the top level it fails because the tree controller does not assign the invisible root item as the parent of the new item. Is there an easy way to have the NSTreeController/NSOutlineView combination work in this situation? I'm considering moving to a datasource for the NSOutlineView if this isn't easily possible. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSManagedObject and weak references under GC
Hi all, I'm converting my garbage-collected document-based application to use Core Data. In my existing implementation, several NSViewControllers keep weak references to the NSDocument object by using the __weak attribute: @interface MyController : NSViewController __weak MyDocument* document; @end This is so that when a document window is closed, the memory for the document is freed. This works fine. The document in turn has a property specified like so: @property (readonly) NSString* foo; However, now that I've switched the document to be a subclass of NSPersistentDocument, I am getting compilation errors in my NSViewController subclass when it tries to access the foo property of the document: document.foo = @bar; - error: property 'foo' not found on object of type 'MyDocument *__attribute__((objc_gc(weak)))' Why would this compiler error be occurring? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [solved] NSManagedObject and weak references under GC
On 04/11/2009, at 3:41 PM, Rob Keniger wrote: However, now that I've switched the document to be a subclass of NSPersistentDocument, I am getting compilation errors in my NSViewController subclass when it tries to access the foo property of the document: document.foo = @bar; - error: property 'foo' not found on object of type 'MyDocument *__attribute__((objc_gc(weak)))' Why would this compiler error be occurring? Turns out it was nothing to do with the weak reference, but a problem with the way I created the foo property in the document object. All working now. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem with allocating memory
On 28/10/2009, at 1:31 PM, Stephen J. Butler wrote: Because you're printing the address of the stack variable myString, which is the same place on the stack every time. Not to mention the fact that you're leaking a string on each iteration through the loop. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sending a Selector to another Class.
On 22/10/2009, at 3:52 PM, Joshua Garnham wrote: Ah, I see. so I need to send it to an instance of the class not the class it self. How would I do that? With respect, please understand that your questions are akin to this: Q. How do I start the car? A. You turn the key. Q. How do I drive? A. ummm You need to learn the basics of Objective-C, it is very clear that you do not understand even the simplest concepts. To directly answer your question, you allocate and initialize an instance of your class using [[YourClass alloc] init], or using a convenience class method or other designated initializer. However, this information is unlikely to help you until you invest some time in learning Objective-C. I personally recommend reading this book: http://www.amazon.com/Programming-Objective-C-2-0-Stephen-Kochan/dp/0321566157 It's all laid down here though: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/index.html -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSColor for darker hightlight color
On 22/10/2009, at 10:26 AM, Jonathan Hendry wrote: There's a 'Developer' color list in the color list pane of the standard color picker. Yes, and I believe this is the picker that Graham was referring to. It shows all the NSColor named colors that reflect the current appearance. To see it, open the standard color picker, go to the third tab Color Palettes and select Developer from the Palette popup to get this list of colors. The developer color picker linked by Kyle is totally different, it allows you to sample colors from the screen and get an NSColor/CGColorRef definition. Useful, but not what the OP requires. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Child window shows up on top despite specifying NSWindowBelow
On 21/10/2009, at 4:40 AM, Jesper Storm Bache wrote: Your analysis (regarding window visibility) sounds plausible as non- visible Cocoa windows have no z-order. I have logged: 6802899 Please add latent z-order to hidden NSWindows for this, but in the meantime I am left with having to move hidden windows off screen and make then visible (then override constrainFrameRect to not move the window back on screen). It's probably better to call NSDisableScreenUpdates(), set the child window ordering/placement/visibility and then call NSEnableScreenUpdates(). This is what I do and it works perfectly. It's one of the main reasons these calls exist, AFAIK. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Child window shows up on top despite specifying NSWindowBelow
On 21/10/2009, at 2:20 PM, Francisco Tolmasky wrote: So I've actually narrowed it down to the fact that my windows have a custom level. If the windows have the standard level then NSWIndowBelow works fine. Any known workarounds for this? What happens when you call -setWindowLevel: on the child window to (yourWindowLevel - 1)? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: correctly Controlling Garbage Collection
On 16/10/2009, at 4:17 PM, WareTo Development wrote: Looking at this problem, we could perform better memory management, so deep garbage collection does not happen that often. This reduces the problem, but can never eliminate it, since sooner or later the garbage clean operation must be done. So we thought the best thing would be to force a garbage collection operation at a time of our choosing. Normally, this occurs at Mouse up, after the user has finished his drawing. A split second of garbage collection then would be barely noticeable by the user. What happens if you explicitly disable Garbage Collection when the user starts drawing and enable it when the user finishes? Something like: - (void)mouseDown:(NSEvent*)event { [[NSGarbageCollector defaultCollector] disable]; //other mouse down stuff } - (void)mouseUp:(NSEvent*)event { [[NSGarbageCollector defaultCollector] enable]; [[NSGarbageCollector defaultCollector] collectExhaustively]; //other mouse up stuff } That way the collector should never fire while the user is drawing. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programming Style: Method Definition with or without a semicolon.
On 17/10/2009, at 10:25 PM, Graham Cox wrote: If there is a way to disable these insertions independently and I've missed it, please someone, let me know how to do it. I can't recommend the ODCompletionDictionary plug-in for Xcode highly enough: http://www.obdev.at/products/completion-dictionary/index.html It allows you to create fully customizable macros and falls back to Xcode's auto-completion if a match can't be found. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: odd behavior with NSError?
On 16/10/2009, at 4:45 PM, Ben Trumbull wrote: Other people have different perspectives on local variable initialization. Wrong perspectives, but different. Fortunately now, they waste their arguments upon the merciless http://llvm.org/img/DragonFull.png Clangdor the Burninator. Excellent. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Multiple relationships between two entities
I'm just getting started with Core Data so go easy on me. I am moving my existing app across to Core Data and I'm having trouble with a few concepts. At present (pre-Core Data) my app has a model object (Item) which is used as the node object in an NSTreeController. This model object has multiple ivars of another custom object (Link) like so: @interface Item : NSObject { Link* normalLink; Link* alternateLink; } @end I'm trying to replicate this in my Core Data model. I have set up two entities, Item and Link. I have created two relationships in the Item entity, normalLink and alternateLink, both pointing to the Link entity. Basically, I want each of these relationships to point to an instance of the Link entity. However, now I have a problem. My Link entity has one relationship (item) which should be the inverse relationship, but that's not possible because I can only have one inverse relationship. I think I'm getting mixed up here, how should this actually be modelled? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Multiple relationships between two entities
On 13/10/2009, at 4:29 PM, Matthew Lindfield Seager wrote: Inverse of what? So Item A has link 1 as it's normal link and link 2 as it's alternate link but then what if link 2 is also the normal link for item B. This won't ever actually happen, the link objects aren't shared between items. I'm only worried about the inverse relationship because Core Data really, really doesn't like one-way relationships. Kiran Kumar's suggestion of storing the link type in the Link entity and then setting up a links relationship in the Item object will probably work just fine for me I think. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Save as PDF?
On 14/10/2009, at 12:02 PM, Laurent Daudelin wrote: Thanks, Aaron. I'll check out the links you mention. But I'm wondering what's happening in general, in all applications, what is the process of drawing an NSView, NSText and so on to end up with a PDF document, not from my own application perspective. In other words, would it be possible to instruct a given application to print a document to a PDF file automatically, without intervention from the user? The functionality is there as you can do it from the print dialog, but I'm wondering if it can be programmatically be done. PDF is a fundamental part of the Mac OS X Quartz drawing architecture. If you draw something to a view, you can get a PDF representation of it. Have a look at the -dataWithPDFInsideRect: method of NSView. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem using filewrappers under snow leopard
On 14/10/2009, at 2:45 PM, Eagle Offshore wrote: See other message - it makes zero difference. I had a problem saving file wrappers in 10.6 where an empty folder file wrapper would not save correctly. I still don't know why not. I was able to diagnose it by making use of the new method in 10.6: - (BOOL)writeToFile:(NSURL *)url options:(NSFileWrapperWritingOptions)options originalContentsURL:(NSURL*)originalContentsURL error:(NSError **)outError The NSError that you get back from this method actually tells you what's going on. Using the 10.5 SDK there is no way to get the error. It's probably worth compiling against the 10.6 SDK and using this method to diagnose the actual error. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Updating application info plist
On 10/10/2009, at 1:19 AM, Kyle Sluder wrote: Sorry, you cannot do this. Changing an app's Info.plist is not supported, especially while the app is running. I've noticed that some apps (LittleSnapper is the first example I can think of), have a hide the app icon in the dock after relaunch option. To do this, surely they must be rewriting the LSUIElement key in the app's own Info.plist while the app is running, right? Or is there another way to do this? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hardware UUID in New Mac Book Pro
On 09/10/2009, at 12:18 AM, Rajendran P wrote: How to fetch the Hardware UUID from New Mac Book Pro. Earlier Mac Book's system Profiler was showing Hardware UUID but in new machines, It might be hidden or stored in any other form/name. Is there any command or (c/cpp) api to get that ID? I don't think that the Hardware UUID is a supported way of identifying a machine. Have a look at: http://developer.apple.com/mac/library/technotes/tn/tn1103.html -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: app delegate +initialize
On 08/10/2009, at 1:39 PM, John Baldwin wrote: Inside the xib is a window which is set to visible at launch. The error happens in the window controller for this window, which is expecting the user defaults to be initialized by the AppController instance. So I'm expecting the AppController instance to be loaded and the +initialize method to be called before my window controller is loaded and its outlets start getting referenced. Both the responses to this have been spot on, but I'd just add that what you can do is create your window in a separate xib, and then instantiate your window controller programmatically from your AppController at a point where you know the user defaults have been loaded. That way you don't need to worry about the order of loading objects from the xib as you control it explicitly. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Rounded NSBox/NSView?
On 06/10/2009, at 1:07 PM, Graham Cox wrote: Views are defined by their frame/bounds rectangles. But there's nothing to stop you from setting a round-cornered clipping path at the start of your view's drawRect method to clip the view's content to a round-cornered rect. Since the view draws nothing by default, the fact that the real edge is a rectangle will not be apparent. Unfortunately the OP is still going to find things difficult. A lot of Apple's standard views, such as NSTableView/NSScrollView seem to set their own custom clipping path during drawing which overrides anything you set, so it's not as straightforward as it might seem. I agree with Kyle, it is probably a good idea to rethink the design. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird NSToolbar glitch
On 02/10/2009, at 6:08 AM, I. Savant wrote: I couldn't find it anywhere in the documentation. But the thing is, it doesn't seem like you can even move a toolbar from one window to another, even properly making sure that it never belongs to more than one at a time, without getting weird drawing errors. I didn't dig too much into that, it's enough to know that it doesn't work. But creating a new one each time DOES work and creates very little additional overhead, as far as I can tell. Toolbars have always been special. It seems a lot of funky things happen when a window is sent -setToolbar: (even with the shiny new IB 3 toolbar editing support). I concur. I had a lot of problems when I tried to swap two toolbars that were created with IB. In my case it was a performance problem, it would take about 1.5 seconds to swap the toolbar, pegging the CPU the whole time. Turned out it was much, much easier to just create a new toolbar instance each time and let the toolbar delegate methods do their work. The toolbar swap is now practically instantaneous. The IB3 editor is nice for simple toolbars but for more complex stuff I'd tend to avoid it. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSWindowController and GC
On 01/10/2009, at 9:20 AM, Bryan Matteson wrote: I was just reminded of something. I use GC in my app, and unless I specifically disable collection for a window controller, it's destroyed as soon as it loses key. I solved it by setting the controller as the delegate of the window, disabling collection for the window controller in windowDidLoad, and re-enabling it in windowWillClose:. Is there another way? Disabling collection for the window controller in this way is a bit of a hack. With Garbage Collection, you need to make sure you have a strong reference to the window controller somewhere. This generally means making the window controller an ivar of another object, e.g. your NSDocument instance. What object creates your window controller in the first place? That's probably the object that needs to hang on to it. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Fast transition between two graphics
On 30/09/2009, at 4:16 AM, Chilton Webb wrote: So now I'm experimenting with using an overlay window with layer backed views, loading the images into the views, showing the window, and drawing the animation by then translating the two views at the same time. Is this the fastest way to do this? You could do it this way, although normally for something like this I'd use Core Image. Make two CIImages and use an animated transition CIFilter. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Fast transition between two graphics
On 30/09/2009, at 10:33 AM, Chilton Webb wrote: I will take a shot at this. My concern is that I've seen CoreImage transitions bog down initially, I guess in their loading phase or something. I have an early model G5 that I use for testing the low end of the Leopard range (and it still looks strange to say G5 and Low End in the same sentence). On that machine, apps that use CoreImage tend to have a visual stutter initially, and I'm not sure if that's a CI thing or an app specific thing. Is there a 'push' effect for CI though? Hmm, actually I don't think there is. There is one if you want to use the private CoreGraphics filters: http://lipidity.com/apple/core-graphics-meet-core-image-demo-app http://lipidity.com/apple/the-ultimate-core-graphics-resource However, it's probably not a good idea for a shipping app. CoreImage uses the GPU, so if the GPU is a bit feeble or you are using really large images then it may have frame rate issues, however Core Animation can have these issues too. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Looking for Sample code: WWDC2007 - Session 201 - Building Animated Cocoa User Interfaces
On 29/09/2009, at 2:22 AM, David Duncan wrote: I believe the demos were called CocoaShuffle and Layer-Backed OpenGL View. Can these be downloaded somewhere? I'm fairly certain both are up on developer.apple.com. I'm not certain they are up under those specific names however. This might be one of the ones you're looking for: http://developer.apple.com/mac/library/samplecode/CocoaSlides/ That was definitely shown at WWDC 2007. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSImage rotation regression?
On 23/09/2009, at 8:46 AM, Marco S Hyman wrote: FYI: a while ago I asked about a possible NSImage rotation regression I didn't see any mention of this in the documentation or release notes. Did I miss it? Yep. Have a look at the AppKit release notes, specifically the section: NSImage: Orientation metadata (e.g. exif) now respected by default You probably need to use the - (id)initWithDataIgnoringOrientation: (NSData *)data method that it mentions. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: an app that never quits
On 23/09/2009, at 1:06 PM, Erick Calder wrote: perhaps I an ask the question differently: if you wanted to be able to respond to physical events (say the location of the phone, or time of day, etc.) throughout the day in some unattended fashion, how would you do it? You can't. the thought comes about because maybe app visibility is not a problem (if that is really the only requirement) vis-á-vis user involvement i.e. if I could install a trigger to bring up my app and it could just close itself, maybe I could get away with a solution. It's just not possible in the current implementation. As others have stated, file a bug if you want things to change. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Handling a File Drag to my Window
On 23/09/2009, at 12:48 PM, Peter Zegelin wrote: I would like to show some sort of visual feedback. I tried subclassing the content view of the window thinking it would automatically hilite, but I can't get it to. Note I set focus ring to default in IB for this. Also the drag icon doesn't update to show a '+' symbol. To change the appearance of a view in response to dragging operations, you should implement the -draggingEntered:, -draggingUpdated: and - draggingExited: protocol methods. To make the plus sign appear next to the cursor, you need to return NSDragOperationCopy as the NSDragOperation from the -draggingEntered: and/or -draggingUpdated: protocol methods. Note that this is only appropriate for dragging events where you're actually copying the content. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Oh notification, where are you?
On 22/09/2009, at 2:31 AM, Michael Thon wrote: NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(sendNotification:) name:@NSMetadataQueryDidFinishGatheringNotification object:nil]; [myThread start]; In the sendNotification: method I send the notification to the other thread using performSelector: onThread: however sendNotification: is never even called. Either the notifications are not, in fact being sent to the main thread or I'm doing something else wrong. There is probably something basic about threads or notifications that I don't understand but I have run out of ideas about what to try next. NSMetadataQueryDidFinishGatheringNotification is a string constant, so you should use it directly and not put it inside the @ string literal container: NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(sendNotification:) name:NSMetadataQueryDidFinishGatheringNotification object:nil]; -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bitmap caching issue (was: settings to build for 10.5 on 10.6?)
On 21/09/2009, at 7:22 AM, Ken Ferry wrote: Well, yes, but copying the data out one way or another is probably safer. :-) Once you've passed a CGImage to some other API, you really don't know how long it'll survive, so it's hard to say when it would be safe to release the NSBitmapImageRep. So would this be acceptable on 10.5/GC? @implementation NSBitmapImageRep (Additions) - (CGImageRef)safeCGImage { CGImageRef cgImage = [self CGImage]; return (CGImageRef) CFMakeCollectable(CGImageCreateCopy(cgImage)); } @end -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bitmap caching issue (was: settings to build for 10.5 on 10.6?)
On 21/09/2009, at 9:21 AM, Ken Ferry wrote: Ah, I forgot about CGImageCreateCopy. No, as noted in the header, /* Return a copy of `image'. Only the image structure itself is copied; the underlying data is not. */ I'm not sure when you _would_ want to use CGImageCreateCopy, actually. Now that you've pointed that out, neither am I! I should always remember to check the header, the docs don't mention this detail. Should I file a bug against the docs? This would do it, I think: Many thanks. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bitmap caching issue (was: settings to build for 10.5 on 10.6?)
On 21/09/2009, at 9:26 AM, Rob Keniger wrote: Now that you've pointed that out, neither am I! I should always remember to check the header, the docs don't mention this detail. Should I file a bug against the docs? Cancel that, I see the documentation for the 10.6 API is much improved. I am developing against 10.5 so haven't been using the 10.6 documentation. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Overcoming crappiness of NSSplitView - what's the magic?
On 16/09/2009, at 12:01 AM, Graham Cox wrote: 1. When I drag the splitter directly, it moves allowing me to position it where I want within the constrained min and max of the contained views. 2. When the window resizes I want the split to stay exactly where it is relative to the top of the window. I do not want it to move proportionally which seems to be the default. In other words the window resize affects the bottom pane only, even though the top one can be resized by the split. Whoever decided that was a sensible behaviour for the default anyway? 3. When the window is resized programatically as well as drag- resized, 2. needs to be true also. Have a look at this excellent article by Matt Gallagher: http://cocoawithlove.com/2009/09/nssplitview-delegate-for-priority-based.html -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Mac Mini or iMac for Cocoa Development?
On 14/09/2009, at 1:48 PM, Graham Cox wrote: Compile time wise, don't worry about it. While compilation seems to have actually got slower over the years Except when nice new compilers come out. Switching to the Clang-LLVM compiler in Snow Leopard has cut my compile times pretty much in half. I highly recommend trying it out. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why the Cocoa function can't be called from JavaScript?
On 14/09/2009, at 1:41 PM, ziqian zhan wrote: When first time welcome.html is loaded into webView from -(void)awakeFromNib;, push the change it button on web page the -(NSString*)getName function is called. The hello world is replaced with hi I'm here.. But when welcome.html loaded again from -(IBAction)loadPage:(id)sender, push the change it button on web page but NOTHING happens. The hello world is no way changed to hi I'm here.. It looks that the JSBridge.getName() disappeared. This is happening because you're setting the value of the JSBridge object in the windowScriptObject before you've even loaded the page: NSString * path = [[NSBundle mainBundle] pathForResource:@welcome ofType:@ html]; [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]]; The windowScriptObject is not valid before the page loads, and then when the page loads you are not registering the JSBridge object with the window. You need to set your object as the WebFrameLoadDelegate and register your JSBridge object in the delegate method - webView:didClearWindowObject:forFrame:, which is called when the windowScriptObject becomes available: - (void)webView:(WebView *)sender didClearWindowObject: (WebScriptObject*)windowObject forFrame:(WebFrame *)frame { [windowObject setValue:self forKey:@JSBridge]; } One other thing I noticed is that you are allowing access to all Objective-C methods in your app by doing this: + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector { return NO; } + (BOOL)isKeyExcludedFromWebScript:(const char *)name { return NO; } This is a massive security hole, you should only allow keys and selectors that you know to be safe to return NO from these methods. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Meta Package in 10.5 to support 10.3 problem
On 08/09/2009, at 9:17 PM, Sparta wrote: I am building a meta package on 10.5 that supports 10.3 (Install Properties). This is the wrong list. You want Installer-dev: http://lists.apple.com/mailman/listinfo/installer-dev -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSImage with multiple representation sizes
On 09/09/2009, at 6:20 AM, Ken Ferry wrote: On 10.6 and later, yes, you can count on it choosing 16x16 pixel representation. We're not looking at resolution anymore, only number of pixels in rep vs number of pixels to be filled. I'm pretty sure it would on previous OSes too, but not 100% positive. It works this way on 10.5. It's easy to test, dump a multi-resolution TIFF into an NSImageView set to resize with the window and scale the window up and down. If the TIFF contains different images at each resolution (say the number 16 for a 16x16px rep, and the number 128 for a 128x128px rep) then you'll see the various representations drawn as you resize. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Semi-document architecture
I have an app in development that is currently implemented as a document-based app, but I'm starting to think it makes little sense for it to be so. What I would like is for the app to have a central document management window, from which you could create/delete documents. Although these are logically documents, I don't want the user to be able to be saved the file anywhere on disk, I want all the documents to be saved centrally in a location of my choosing (i.e. the Application Support folder). The user should not be able to do a Save As. I also don't really want the Command-Clickable title in the document window as the location on disk is not relevant to the user. However, I still want one window per app, undo support and Save menu item functionality, which all come for free with the NSDocument architecture. Would I be best off to migrate away from the NSDocumentController/ NSDocument architecture and shoehorn my own document management controller logic in its place? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Semi-document architecture
On 04/09/2009, at 4:42 PM, Kyle Sluder wrote: Sounds like a job for a custom NSDocumentController subclass. Of course, thanks for the pointer. The user should not be able to do a Save As. I also don't really want the Command-Clickable title in the document window as the location on disk is not relevant to the user. Your NSDocument subclass can handle this And you can disable the titlebar path control easily enough. Ah, I see, I can override -synchronizeWindowTitleWithDocumentName in NSWindowController. That is easier than I thought. However, I still want one window per app, undo support and Save menu item functionality, which all come for free with the NSDocument architecture. I assume you meant one window per document? Yes, sorry, that was a typo. Would I be best off to migrate away from the NSDocumentController/ NSDocument architecture and shoehorn my own document management controller logic in its place? No. You will still get a lot out of NSDocument with a moderate amount of customization. Great, thanks! -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Massive slowdown in NSArrayController selections in 10.6
On 04/09/2009, at 12:43 PM, Rob Keniger wrote: I'm interested to know if anyone else has been bitten by what seems to be a fairly serious performance regression bug in 10.6 with NSArrayController/NSTreeController. Basically, if you have an NSArrayController with more than a few bindings, changing selection in the controller takes at least an order of magnitude more time than in Leopard. I added a benchmark to my sample project to loop through the array controller, selecting each object in turn: NSTimeInterval t = [NSDate timeIntervalSinceReferenceDate]; NSUInteger j=0; for(j=0;j20;j++) { [arrayController setSelectionIndex:j]; } NSLog(@duration %f, [NSDate timeIntervalSinceReferenceDate] - t); /* DEBUG LOG */ As you increase the number of bound properties this benchmark increases non-linearly: 10 properties: 12.989ms 25 properties: 50.816ms 50 properties: 166.453ms 100 properties: 681.625ms 150 properties: 2294.942ms 200 properties: 3295.174ms 250 properties: 7175.009ms 300 properties: 11204.541ms 600 properties: 65377.478ms Has no-one else experienced these slowdowns? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Massive slowdown in NSArrayController selections in 10.6
I'm interested to know if anyone else has been bitten by what seems to be a fairly serious performance regression bug in 10.6 with NSArrayController/NSTreeController. Basically, if you have an NSArrayController with more than a few bindings, changing selection in the controller takes at least an order of magnitude more time than in Leopard. This is causing major slowdowns in my app, which has a bunch of inspector panels with controls all bound to an NSTreeController. This example project demonstrates the issue: http://secretsoftwarefactory.com/bugs/KVOBugtest.zip The sample app takes about 50ms to change selection on Leopard, but 500-1500ms to change selection on 10.6. Shark profiling shows that the time is largely taken up with calls to auto_read_weak_reference(), readWeakAt() and objc_read_weak(). It makes no difference if the app is run under GC or not. I would have thought that quite a few apps would have seen this problem as the performance degradation is so dramatic. I've filed this bug as rdar://7139579 if anyone wants to reference it. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: learning the NSView structure of an app?
On 29/08/2009, at 2:08 AM, sag lists wrote: As a relatively new cocoa developer, one thing I struggle with is determining on visual inspection how an app is constructed in terms cocoa views. Some things are obvious like splitter views, the toolbar, etc. But some are not. Does anyone know if there is a way to examine the view hierarchy of an app? Or alternatively, a good way to learn many of the common app layout patterns? If you launch your app executable with the argument -NSShowAllViews YES, then you will be able to see all the views and their hierarchy using color-coded border highlights. You can either add the argument to your executable in Xcode or run your app from the command line: ./YourApp.app/Contents/MacOS/YourApp -NSShowAllViews YES -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Making failed NSAsserts crash an app
On 27/08/2009, at 7:49 AM, Squ Aire wrote: Since I absolutely want some information on whenever my NSAsserts fail (because they should NEVER fail and I want to know about it if they do! (at least during beta testing!)), my question is: How can I guarantee that a failed NSAssert will crash my application? I want it to happen in such a way that the next time the user loads the app, the info about the failed NSAssert (perhaps the 2nd description string argument I supply to it, or even the line of code and code file) will go along with the crash reports. You could raise exceptions instead of generating assertion failures. Exceptions are caught by several of the crash reporting frameworks. You could probably map the NSAssert macros to exception-generation code for your beta builds. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to Convert #FF00FF String Specifying RGB Color to 32 bit int
On 27/08/2009, at 9:50 AM, Peter Zegelin wrote: I have some xml where an rgb color value is specified via a #XXYYZZ type string. The xml is being read in via NSXMLParser. I can't seem to find an easy Cocoa way to convert this value to an unsigned int. I need an unsigned int rather than an NSColor as the value is used in C++ code. Does anyone know of something I may be missing? Something like this? //assume colorString is something like @#AABBCC unsigned colorCode = 0; unsigned char redByte, greenByte, blueByte; if (nil != colorString) { NSScanner* scanner = [NSScanner scannerWithString:colorString]; (void) [scanner scanHexInt:colorCode]; } redByte = (unsigned char)(colorCode 16); greenByte = (unsigned char)(colorCode 8); blueByte = (unsigned char)(colorCode); -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com