NSTableView animation parameters
Hi all, I'm using [NSTableView moveRowAtIndex:toIndex:] to show an animation for a row reordering on drag/drop. These rows control the ordering of a stack of adjacent views which are also animated by using [[view animator] setFrame:]; The idea is to make it seem that the table rows and the stack of views are in effect all tied together (these views can't be part of the table themselves because they need to scroll horizontally independently and also scale, etc). The animations are similar but not identical which is not quite as visually slick as it could be. I'm trying to modify the view animation by implementing -animationForKey: in the moved view and changing the animation parameters. It helps, but I'm still not quite there yet. Does anyone know what the table view row animation parameters are (or can think of a way I can find them out) so that I can make the two act together? I probably only need to know the overall time and the timeFunction. --Graham ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTableView animation parameters
On 21/11/2012, at 7:21 PM, Graham Cox graham@bigpond.com wrote: Hi all, I'm using [NSTableView moveRowAtIndex:toIndex:] to show an animation for a row reordering on drag/drop. I also have a related question: Is it possible to show a table row animation during the drag to have a gap open where the dropped row would be inserted? I'm sure I've seen this done somewhere, but the sample code TableVewPlayground doesn't show this. --Graham ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Does UIStoryboard know how to find the ~ipad version automatically?
I had hoped this: [UIStoryboard storyboardWithName: @MainStoryboard bundle: nil] would load the storyboard named MainStoryboard~ipad, but it didn't seem to work. Is it supposed to? TIA, -- Rick ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How To Safely Invoke a Block
I've defined a class Foo that defines a block via a property: @property (copy) void (^progressHandler)(RXProgressState progressState, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); The property is synthesized by the compiler, ARC enabled. The block is usually invoked on a private thread for several times until an action finishes (an asynchronous NSURLConnection). A client of class Foo should be able to set the block property at any time from any thread - that is it should also be able to set the block to NULL. Now, I'm worried about thread safety. First, is it a good measurement to use a property with the atomic attribute? Secondly, I'm invoking the block as follows (from within a NSURLConnectionDelegate method): progress_handler_block_t block; if ( (block=self.progressHandler) != NULL) { block(RXProgressStateStart, 0, self.source.size); } since it appears to me, that if (_progressHandler) { _progressHandler(RXProgressStateStart, 0, self.source.size); } or if (self.progressHandler) { self.progressHandler(RXProgressStateStart, 0, self.source.size); } isn't thread safe. Your comments are welcome! Regards Andreas ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How To Safely Invoke a Block
On 21 Nov 2012, at 10:56, Andreas Grosam agro...@onlinehome.de wrote: I've defined a class Foo that defines a block via a property: @property (copy) void (^progressHandler)(RXProgressState progressState, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); The property is synthesized by the compiler, ARC enabled. The block is usually invoked on a private thread for several times until an action finishes (an asynchronous NSURLConnection). A client of class Foo should be able to set the block property at any time from any thread - that is it should also be able to set the block to NULL. Now, I'm worried about thread safety. First, is it a good measurement to use a property with the atomic attribute? Not really, as your block may be released (by the setter) between getting the block and invoking it. Secondly, I'm invoking the block as follows (from within a NSURLConnectionDelegate method): progress_handler_block_t block; if ( (block=self.progressHandler) != NULL) { block(RXProgressStateStart, 0, self.source.size); } since it appears to me, that if (_progressHandler) { _progressHandler(RXProgressStateStart, 0, self.source.size); } or if (self.progressHandler) { self.progressHandler(RXProgressStateStart, 0, self.source.size); } isn't thread safe. Your comments are welcome! Grand Central Dispatch is your friend. @implementation MyClass static dispatch_once_t onceToken; static dispatch_queue_t dispatchQueue; typedef (void(^ProgressHandler)(RXProgressState progressState, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); - (void)setProgressHandler:(ProgressHandler)progressHandler { dispatch_once(onceToken, ^ { dispatchQueue = dispatch_queue_create(RXProgressQueue, DISPATCH_QUEUE_SERIAL); }); dispatch_sync(dispatchQueue, ^() { if (_progressHandler != progressHandler) { [_progressHandler release]; _progressHandler = [progressHandler copy]; } }); } - (void)progressHandler { return _progressHandler; } - (void)callSite { … dispatch_once(onceToken, ^ { dispatchQueue = dispatch_queue_create(RXProgressQueue, DISPATCH_QUEUE_SERIAL); }); dispatch_sync(dispatchQueue, ^() { ProgressHandler handler = [self progressHandler]; handler(…); }); … } Tom Davie ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How To Safely Invoke a Block
On Nov 21, 2012, at 5:09 AM, Tom Davie wrote: On 21 Nov 2012, at 10:56, Andreas Grosam agro...@onlinehome.de wrote: I've defined a class Foo that defines a block via a property: @property (copy) void (^progressHandler)(RXProgressState progressState, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); The property is synthesized by the compiler, ARC enabled. The block is usually invoked on a private thread for several times until an action finishes (an asynchronous NSURLConnection). A client of class Foo should be able to set the block property at any time from any thread - that is it should also be able to set the block to NULL. Now, I'm worried about thread safety. First, is it a good measurement to use a property with the atomic attribute? Not really, as your block may be released (by the setter) between getting the block and invoking it. An atomic property's synthesized getter does the equivalent of retain plus autorelease. So, the caller can rely on the received value staying valid for the current scope. https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW28 Grand Central Dispatch is your friend. @implementation MyClass static dispatch_once_t onceToken; static dispatch_queue_t dispatchQueue; typedef (void(^ProgressHandler)(RXProgressState progressState, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite); - (void)setProgressHandler:(ProgressHandler)progressHandler { dispatch_once(onceToken, ^ { dispatchQueue = dispatch_queue_create(RXProgressQueue, DISPATCH_QUEUE_SERIAL); }); dispatch_sync(dispatchQueue, ^() { if (_progressHandler != progressHandler) { [_progressHandler release]; _progressHandler = [progressHandler copy]; } }); } - (void)progressHandler { return _progressHandler; } - (void)callSite { … dispatch_once(onceToken, ^ { dispatchQueue = dispatch_queue_create(RXProgressQueue, DISPATCH_QUEUE_SERIAL); }); dispatch_sync(dispatchQueue, ^() { ProgressHandler handler = [self progressHandler]; handler(…); }); … } You are running the block within the dispatch_sync() block, meaning that the queue is monopolized for however long that runs. That's likely undesirable and prone to deadlocks. If you wanted to do something like this, you would declare 'handler' as __block outside of the dispatch_sync(), retrieve it with the dispatch_sync() block, and then call it after that returns. ARC will ensure that it's retained by the implicitly-strong 'handler' variable. However, that's overkill. Regards, Ken ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Image manipulation/composition library
Hello all Do anybody know is there a free image composition library like this one - http://www.ideveloper.az/index.php?/home/show_appl/raapiccomposer with adding text, rotating, scaling, moving etc. Cheer, RAA ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Image manipulation/composition library
SIPS is built in to the Mac and accessible from the shell. Also, there is imagemagick. http://www.imagemagick.org/script/index.php On Nov 21, 2012, at 7:51 AM, Rufat A. Abdullayev wrote: Hello all Do anybody know is there a free image composition library like this one - http://www.ideveloper.az/index.php?/home/show_appl/raapiccomposer with adding text, rotating, scaling, moving etc. Cheer, RAA ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: Image manipulation/composition library
Hello Alex Thank you for answering I forgot to write that I need library for iOS (iPhone/iPad) devices Thank you a lot -Original Message- From: Alex Zavatone [mailto:z...@mac.com] Sent: Wednesday, November 21, 2012 5:31 PM To: Rufat A. Abdullayev Cc: Cocoa-Dev List Subject: Re: Image manipulation/composition library SIPS is built in to the Mac and accessible from the shell. Also, there is imagemagick. http://www.imagemagick.org/script/index.php On Nov 21, 2012, at 7:51 AM, Rufat A. Abdullayev wrote: Hello all Do anybody know is there a free image composition library like this one - http://www.ideveloper.az/index.php?/home/show_appl/raapiccomposer with adding text, rotating, scaling, moving etc. Cheer, RAA ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com This email sent to z...@mac.com ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does UIStoryboard know how to find the ~ipad version automatically?
On 21 Nov, 2012, at 5:24 PM, Rick Mann rm...@latencyzero.com wrote: I had hoped this: [UIStoryboard storyboardWithName: @MainStoryboard bundle: nil] would load the storyboard named MainStoryboard~ipad, but it didn't seem to work. Is it supposed to? TIA, -- Rick You'd think it would .. it doesn't. You might think about filing a bug on this one, it's a bit daft. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: enhancing NSTextView for optionally-hidden text
Nov 21, 2012, at 2:26 AM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Nov 20, 2012, at 21:03 , Kurt Bigler kkbli...@breathsense.com wrote: Given how this view is used, for appending only in the style of an uneditable text log permitting user selections and Copy, the easiest way I can think to implement it is to maintain two text views, one with hidden text included, and one without, and simply swap the two views to implement show/hide of hidden text. Is there a better way? I would rather not get deep into a highly-structured text document kind of model in order to achieve something like this (assuming that even helps). Perhaps better than two views would be two attributed string properties (of the object that knows when the log changes). In one, you'd either mark the hideable text with the (unique?) attribute that indicates the hideability in the display, or with an custom attribute. The way to do this is by subclassing NSGlyphGenerator to return null glyphs for text that has your custom Hidden attribute. A WWDC video from a few years back shows how. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: enhancing NSTextView for optionally-hidden text
On Wed, Nov 21, 2012, at 07:25 AM, Ross Carter wrote: The way to do this is by subclassing NSGlyphGenerator to return null glyphs for text that has your custom Hidden attribute. A WWDC video from a few years back shows how. Specifically, start watching from around 21:00 in the video for Session 114—Advanced Cocoa Tips and Tricks from WWDC 2010. --Kyle Sluder ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: FileWrapper iCloud
The wrapper functionality is a remnant of NSPersistentDocument but I don't use it anymore. Thanks for your answers, this was helpful. On Nov 10, 2012, at 1:28 PM, Sean McBride s...@rogue-research.com wrote: On Sat, 10 Nov 2012 18:09:58 +, Luke Hiesterman said: File wrappers don't make it inherently easier or harder to deal with iCloud. File packages (which you would use file wrappers to represent) can be elegant means of wrapping up document data because it allows for easy separation of distinct components, and are usually recommended if they at all make sense for your application. Unless you use NSPersistentDocument, which still, after all these years, and even after the addition of 'external storage' support in 10.7, doesn't support file wrappers. :( Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IBOutlet NSNumber
Hey, sorry I never responded. I just completely forgot. I don't know what was up when I first read your email, but I just took in the wrong way I guess. After reading your second explanation, I understand what you meant about NSNumber. I was trying to bind the NSComboBox index to a NSNumber object mainly because the index was only needed temporarily. Anyway, for the record, I decided that a NSComboBox was really not the correct tool for what I wanted to do anyway. The HIG says the NSComboBox should allow the user to enter a custom value and use the values in the list as auto-complete suggestions. Since I do not want to allow custom values, a table view with a search box was a much better solution and works great. With the table view bound to an array controller, all I needed to do was use selectedIndexes to index arrangedObjects to get the information I need from the user's selection. Thanks for the help. On Oct 13, 2012, at 10:38 PM, Ken Thomases k...@codeweavers.com wrote: On Oct 13, 2012, at 11:17 PM, Randy Widell wrote: Wow. Woah. OK, sorry my ignorance offends. I didn't express offense. At least, I didn't intend to. What in the world was I trying to do…I was trying to bind the selection index of a NSComboBox to a NSNumber because the Apple Cocoa bindings document for NSComboBox says the value can be bound to a NSNumber. It can be bound to a _property_ of some object where the type of that property is NSNumber. Using -init didn't seem so nonsensical to me. It could it init with 0. It could init with NaN. But, you're right, -init is not listed in the NSNumber class reference and that should have been a clue. Well, more to the point: an NSNumber is immutable. It can only have the value it was initialized with. So, if you instantiate one in a NIB, whether it got a value of 0 or NaN, it would be stuck with that value forever. So, my point was: what good is it to bind a view's selection (or whatever) to a constant value? Anyway, cool, I just decided to use -indexOfSelectedItem on a NSComboBox outlet when the sheet finishes. That works, but it would also have worked to bind the value binding of the NSComboBox to a property of some controller object. My concern is that you were trying to bind it to an object (rather than a property of an object) which betrays a fundamental confusion, and I wanted to bring that out into the open so you could work through it. Regards, Ken ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSArrayController KVO question...
Searching around the Internet, I see a lot of questions and answers about how to observe changes to properties of objects in a NSArrayController. Everything I have seen, though, relates to a third object doing the observing. For instance: [arrayController addObserver: viewObject forKeyPath: @arrangedObjects.someProperty ... ] I am trying to do something similar, but I want to notify the array controller itself. I have an array controller that drives a table view, enables/disables an action button, and updates check marks for menu items in the action button's drop down menu. That all works fine. When I select an action, I want to change a property and update all of the array controller's bindings (update the table view to reflect the change, update the drop down menu's check mark). For example, I have an archive action that should update the item's cell in the table view to display the archived graphic and Archive should be checked in the drop down menu. I followed the Hillegass example of adding an observer whenever an item is added to the array controller and removing the observer whenever an item is removed from the array controller. So, I have... - (void) startObserving: (id) object { [object addObserver: arrayController forKeyPath: @someProperty ... ]; } - (void) stopObserving: (id) object { [object removeObserver: arrayController forKeyPath: @someProperty ... ]; } The idea being that the array controller is notified whenever someProperty changes. However, nothing happens when I change the property. I used my window controller as the observer instead of the array controller, added an observeValueForKeyPath:... method and verified that changing the property of an object does, in fact, trigger an observeValueForKeyPath:... call. So, two questions: 1) is it even the correct approach to have the array controller observe changes in order to update bindings?, 2) if it is, is there something I am missing? ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does UIStoryboard know how to find the ~ipad version automatically?
Done. 12738494 On Nov 21, 2012, at 6:48 , Roland King r...@rols.org wrote: On 21 Nov, 2012, at 5:24 PM, Rick Mann rm...@latencyzero.com wrote: I had hoped this: [UIStoryboard storyboardWithName: @MainStoryboard bundle: nil] would load the storyboard named MainStoryboard~ipad, but it didn't seem to work. Is it supposed to? TIA, -- Rick You'd think it would .. it doesn't. You might think about filing a bug on this one, it's a bit daft. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com This email sent to rm...@latencyzero.com -- Rick ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSFileManager - Incompatible persistent store
I'm working with some code that accesses a data model in Xcode. String data is written to an xml file in the app (Mac) and displayed in a list. The inputted text is saved as body text and title. The app compiles but I receive a warning upon launch, *The managed object model version used to open the persistent store is incompatible with the one that is used to create the persistent store.* The app launches and I'm able to save (kinda) the inputted text, add title, and view from a list of created titles/body text. The only problem is the inputted text is not saved and reopened once the app launches again. I'm assuming this has to be because of the persistent store. I receive a warning in Xcode about this line of code dealing with the file manager, fileManager = [NSFileManager defaultManager]; applicationSupportFolder = [self applicationSupportFolder]; if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } -- - Tom Miller t...@pxlc.me pxlc.me ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSArrayController KVO question...
On 21 Nov 2012, at 20:42, Randy Widell bornagainsl...@gmail.com wrote: Searching around the Internet, I see a lot of questions and answers about how to observe changes to properties of objects in a NSArrayController. Everything I have seen, though, relates to a third object doing the observing. For instance: [arrayController addObserver: viewObject forKeyPath: @arrangedObjects.someProperty ... ] I am trying to do something similar, but I want to notify the array controller itself. I have an array controller that drives a table view, enables/disables an action button, and updates check marks for menu items in the action button's drop down menu. That all works fine. When I select an action, I want to change a property and update all of the array controller's bindings (update the table view to reflect the change, update the drop down menu's check mark). For example, I have an archive action that should update the item's cell in the table view to display the archived graphic and Archive should be checked in the drop down menu. I followed the Hillegass example of adding an observer whenever an item is added to the array controller and removing the observer whenever an item is removed from the array controller. So, I have... - (void) startObserving: (id) object { [object addObserver: arrayController forKeyPath: @someProperty ... ]; } - (void) stopObserving: (id) object { [object removeObserver: arrayController forKeyPath: @someProperty ... ]; } The idea being that the array controller is notified whenever someProperty changes. However, nothing happens when I change the property. I used my window controller as the observer instead of the array controller, added an observeValueForKeyPath:... method and verified that changing the property of an object does, in fact, trigger an observeValueForKeyPath:... call. So, two questions: 1) is it even the correct approach to have the array controller observe changes in order to update bindings?, 2) if it is, is there something I am missing? ___ Do you really want to update the arrayController bindings rather than update the model? If you want to have the tableview reflect the model's archive property then set it on the model. The reason your observation isn't working is because the KVO notification is being sent to the NSArrayController instance and it's default implementation of - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context (if it exists) will ignore it . You would have to subclass NSArrayController. The window controller implementation works because you can catch - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context. There is no reason not to let the window controller catch the observation and reconfigure the NSArrayController accordingly. Regards Jonathan Mitchell Mugginsoft LLP KosmicTask - the Integrated Scripting Environment for OS X. http://www.mugginsoft.com/KosmicTask ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSArrayController KVO question...
Hmm. Well, I am updating the model (and the database that backs it). I just need the UI to reflect it. I guess I was assuming that NSArrayController would respond to a value observation the same way it responds to, for instance, a selection change in the table view (updates the menu item's check mark). So, if the window controller has to catch the observation, what's the proper way to have the array controller update the UI? I tried removing the objects affected and adding them back in with the changed value which resulted in some weirdness while iterating over selectedObjects. Not sure I want to re-query the database to update the full contents of the array controller either...unless it's necessary. On Nov 21, 2012, at 13:46, jonat...@mugginsoft.com jonat...@mugginsoft.com wrote: On 21 Nov 2012, at 20:42, Randy Widell bornagainsl...@gmail.com wrote: Searching around the Internet, I see a lot of questions and answers about how to observe changes to properties of objects in a NSArrayController. Everything I have seen, though, relates to a third object doing the observing. For instance: [arrayController addObserver: viewObject forKeyPath: @arrangedObjects.someProperty ... ] I am trying to do something similar, but I want to notify the array controller itself. I have an array controller that drives a table view, enables/disables an action button, and updates check marks for menu items in the action button's drop down menu. That all works fine. When I select an action, I want to change a property and update all of the array controller's bindings (update the table view to reflect the change, update the drop down menu's check mark). For example, I have an archive action that should update the item's cell in the table view to display the archived graphic and Archive should be checked in the drop down menu. I followed the Hillegass example of adding an observer whenever an item is added to the array controller and removing the observer whenever an item is removed from the array controller. So, I have... - (void) startObserving: (id) object { [object addObserver: arrayController forKeyPath: @someProperty ... ]; } - (void) stopObserving: (id) object { [object removeObserver: arrayController forKeyPath: @someProperty ... ]; } The idea being that the array controller is notified whenever someProperty changes. However, nothing happens when I change the property. I used my window controller as the observer instead of the array controller, added an observeValueForKeyPath:... method and verified that changing the property of an object does, in fact, trigger an observeValueForKeyPath:... call. So, two questions: 1) is it even the correct approach to have the array controller observe changes in order to update bindings?, 2) if it is, is there something I am missing? ___ Do you really want to update the arrayController bindings rather than update the model? If you want to have the tableview reflect the model's archive property then set it on the model. The reason your observation isn't working is because the KVO notification is being sent to the NSArrayController instance and it's default implementation of - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context (if it exists) will ignore it . You would have to subclass NSArrayController. The window controller implementation works because you can catch - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context. There is no reason not to let the window controller catch the observation and reconfigure the NSArrayController accordingly. Regards Jonathan Mitchell Mugginsoft LLP KosmicTask - the Integrated Scripting Environment for OS X. http://www.mugginsoft.com/KosmicTask ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/bornagainslakr%40gmail.com This email sent to bornagainsl...@gmail.com ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileManager - Incompatible persistent store
On 21 Nov 2012, at 21:16, Tom Miller t...@pxlc.me wrote: I receive a warning in Xcode about this line of code dealing with the file manager, fileManager = [NSFileManager defaultManager]; applicationSupportFolder = [self applicationSupportFolder]; if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } Care to tell us what the warning actually is? ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileManager - Incompatible persistent store
On Wednesday, November 21, 2012, Tom Miller wrote: Sorry my bad! The warning states 'createDirectoryAtPath:attributes:' is depreciated. I was able to get rid of that window warning once the app launched, miss spelled something in my code. Though I'm still unable to save the imputed text to the XML. I can provide the entire set of code if needed to. On Wednesday, November 21, 2012, Mike Abdullah wrote: On 21 Nov 2012, at 21:16, Tom Miller t...@pxlc.me wrote: I receive a warning in Xcode about this line of code dealing with the file manager, fileManager = [NSFileManager defaultManager]; applicationSupportFolder = [self applicationSupportFolder]; if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } Care to tell us what the warning actually is? -- - Tom Miller t...@pxlc.me javascript:_e({}, 'cvml', 't...@pxlc.me'); pxlc.me -- - Tom Miller t...@pxlc.me pxlc.me ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSFileManager - Incompatible persistent store
Sorry my bad! The warning states 'createDirectoryAtPath:attributes:' is depreciated. I was able to get rid of that window warning once the app launched, miss spelled something in my code. Though I'm still unable to save the imputed text to the XML. I can provide the entire set of code if needed to. On Wednesday, November 21, 2012, Tom Miller wrote: Sorry my bad! The warning states 'createDirectoryAtPath:attributes:' is depreciated. I was able to get rid of that window warning once the app launched, miss spelled something in my code. Though I'm still unable to save the imputed text to the XML. I can provide the entire set of code if needed to. On Wednesday, November 21, 2012, Mike Abdullah wrote: On 21 Nov 2012, at 21:16, Tom Miller t...@pxlc.me wrote: I receive a warning in Xcode about this line of code dealing with the file manager, fileManager = [NSFileManager defaultManager]; applicationSupportFolder = [self applicationSupportFolder]; if ( ![fileManager fileExistsAtPath:applicationSupportFolder isDirectory:NULL] ) { [fileManager createDirectoryAtPath:applicationSupportFolder attributes:nil]; } Care to tell us what the warning actually is? -- - Tom Miller t...@pxlc.me javascript:_e({}, 'cvml', 't...@pxlc.me'); pxlc.me -- - Tom Miller t...@pxlc.me pxlc.me ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
filterPredicate not effecting NSArrayController
Hello list, I have the following code as the action for an NSSearchField (lifted liberally from a CIMGF article)): - (IBAction) updateFilter:(id)sender { // clobber any previous value - from SO article - has no effect [self.peopleArrayController setFilterPredicate: nil]; NSMutableString * searchText = [NSMutableString stringWithString:self.searchField.stringValue]; // Remove extraenous whitespace while ([searchText rangeOfString:@ ].location != NSNotFound) { [searchText replaceOccurrencesOfString:@ withString:@ options:0 range:NSMakeRange(0, [searchText length])]; } //Remove leading space if ([searchText length] != 0) [searchText replaceOccurrencesOfString:@ withString:@ options:0 range:NSMakeRange(0,1)]; //Remove trailing space if ([searchText length] != 0) [searchText replaceOccurrencesOfString:@ withString:@ options:0 range:NSMakeRange([searchText length]-1, 1)]; if ([searchText length] == 0) { [self.peopleArrayController setFilterPredicate:nil]; return; } NSArray * searchTerms = [searchText componentsSeparatedByString:@ ]; if ([searchTerms count] == 1) { NSPredicate * p = [NSPredicate predicateWithFormat:@(firstName contains[cd] %@) OR (lastName contains[cd] %@) OR (organization contains[cd] %@), searchText, searchText, searchText]; [self.peopleArrayController setFilterPredicate:p]; } else { NSMutableArray * subPredicates = [[NSMutableArray alloc] init]; for (NSString * term in searchTerms) { NSPredicate * p = [NSPredicate predicateWithFormat:@(firstName contains[cd] %@) OR (lastName contains[cd] %@) OR (organization contains[cd] %@), term, term, term]; [subPredicates addObject:p]; } NSPredicate * cp = [NSCompoundPredicate andPredicateWithSubpredicates:subPredicates]; [self.peopleArrayController setFilterPredicate:cp]; } [self.peopleArrayController rearrangeObjects]; [self.tableView reloadData]; } The tableView is bound to an arrayController object in XIB, which is in turn a ref to this (weak) peopleArrayController in the windowController. The predicates (whichever is triggered) print to log just as expected. But the contents of the tableView are not reduced. The table displays the entire contents of the peopleArrayController.arrangedObjects unfiltered. Is there another step required? In the bindings inspector Controller Content Parameters is a filterPredicate panel. Do I have to wire this up to a property which holds the current predicate to be applied ? - Erik OSX 10.8/XC 4.5.2 ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPad to Desktop over WiFi
I would like to write an iOS app that can communicate with a Mac or PC over a WiFi connection without having to go over the internet. Has anyone attempted this? If so, did you use TCP/IP or HTTP? Thank you. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSRulerMarker question
Hi all, I'm adding ruler markers to a horizontal ruler view, and setting the client of the ruler to my custom view. When I drag the ruler markers, the client view receives the client messages as documented. What I want to do is move a vertical line in my view as the marker moves. So, when I get the 'willmove' message, I invalidate the old and new locations. My drawRect method then should draw the lines based on the list of markers. While I see my -drawRect method getting called, and know it draws the right thing in the normal case, during marker dragging nothing happens (i.e. the old line is never erased and the new line never drawn). The standard NSRulerMarker draws a black line in the client view as it is dragged. This comes 'for free' but I wonder how on earth it works. There is also no way to customise it that I can see. I'm wondering if this behaviour is interfering with view updates in my client view, but since it's not mentioned in the documentation I can only speculate. It seems to me NSRulerMarker is set up for its use in NSTextView and though the design seems to be fine for the more general case, in actual use the extra undocumented behaviours baked into it for use in a text view make it hard to use and not work as documented. So, simple question: how can I keep an associated line in my client view moving as I drag a ruler marker? relevant parts of the code: - (CGFloat) rulerView:(NSRulerView*) aRulerView willMoveMarker:(NSRulerMarker*) aMarker toLocation:(CGFloat) location { CGFloat oldLocation = [aMarker markerLocation]; // update the view where the old marker line was drawn NSRect br = [self bounds]; br.origin.x = oldLocation - 1.0; br.size.width = 2.0; [self setNeedsDisplayInRect:br]; return location; } - (void)awakeFromNib { NSScrollView* sv = [self enclosingScrollView]; [sv setHasHorizontalRuler:YES]; NSRulerView*rv = [[self enclosingScrollView] horizontalRulerView]; [rv setClientView:self]; [sv setRulersVisible:YES]; // set up a ruler marker to represent events [self addEventMarkerAtTime:1.0 forKey:@One Second]; // creates NSRulerMarker and adds it to ruler view } // called within -drawRect: method of the view after erasing to the background colour - (void)drawEventMarkers { NSArray* markers = [[[self enclosingScrollView] horizontalRulerView] markers]; for( NSRulerMarker* marker in markers ) [self drawEventMarker:marker]; } - (void)drawEventMarker:(NSRulerMarker*) marker { CGFloat pos = [marker markerLocation]; NSPoint a, b; NSRect br = [self bounds]; a.x = b.x = pos; a.y = NSMinY( br ); b.y = NSMaxY( br ); [NSBezierPath setDefaultLineWidth:0.75]; [[NSColor yellowColor] set]; [NSBezierPath strokeLineFromPoint:a toPoint:b]; } ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
nssound question
Hi, In my project there are times I call NSBeep and times when I use NSSound and play one of Finder's system sounds that have to do with file-movement (for example the undo sound). Problem is NSBeep gets played through the user's internal Mac speakers where as using NSSound is played through a user's external speakers assuming they are using them. This can make a big difference in sound volume. Is there any solution/workaround for this? Or just to make a preference to disable the calls to NSSound? Thanks for the input, rc ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: nssound question
On Nov 21, 2012, at 3:54 PM, Rick C. wrote: In my project there are times I call NSBeep and times when I use NSSound and play one of Finder's system sounds that have to do with file-movement (for example the undo sound). Problem is NSBeep gets played through the user's internal Mac speakers where as using NSSound is played through a user's external speakers assuming they are using them. This can make a big difference in sound volume. Is there any solution/workaround for this? Or just to make a preference to disable the calls to NSSound? Thanks for the input, Are you sure this is the case? All sounds (including system beeps) on my Macs always play through external speakers when connected, and I don't seem to have any way to tell it otherwise… HTH, Keary Suska Esoteritech, Inc. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: nssound question
On Nov 21, 2012, at 6:04 PM, Keary Suska cocoa-...@esoteritech.com wrote: Are you sure this is the case? All sounds (including system beeps) on my Macs always play through external speakers when connected, and I don't seem to have any way to tell it otherwise… Sound preference pane, Sound Effects tab. It lets you select the device for sound effects. I've mine to Internal Speakers. Another choice is Selected sound output device. Marc ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: nssound question
In System Preferences Sound, there is a setting to Play sound effects through… I believe this changes where alert sounds are played. I expect NSSound by default uses the selected sound output device (selected in the Output tab of the preference panel). But it seems to have a setPlaybackDeviceIdentifier: method that I've never tried using. Dave On 2012-11-21, at 9:04 PM, Keary Suska cocoa-...@esoteritech.com wrote: On Nov 21, 2012, at 3:54 PM, Rick C. wrote: In my project there are times I call NSBeep and times when I use NSSound and play one of Finder's system sounds that have to do with file-movement (for example the undo sound). Problem is NSBeep gets played through the user's internal Mac speakers where as using NSSound is played through a user's external speakers assuming they are using them. This can make a big difference in sound volume. Is there any solution/workaround for this? Or just to make a preference to disable the calls to NSSound? Thanks for the input, Are you sure this is the case? All sounds (including system beeps) on my Macs always play through external speakers when connected, and I don't seem to have any way to tell it otherwise… HTH, Keary Suska Esoteritech, Inc. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca This email sent to dave.fernan...@utoronto.ca ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: filterPredicate not effecting NSArrayController
On Nov 21, 2012, at 6:27 PM, Erik Stainsby wrote: [self.peopleArrayController setFilterPredicate: nil]; [self.peopleArrayController setFilterPredicate:p]; [self.peopleArrayController setFilterPredicate:cp]; [self.peopleArrayController rearrangeObjects]; [self.tableView reloadData]; The tableView is bound to an arrayController object in XIB, which is in turn a ref to this (weak) peopleArrayController in the windowController. The predicates (whichever is triggered) print to log just as expected. But the contents of the tableView are not reduced. The table displays the entire contents of the peopleArrayController.arrangedObjects unfiltered. Is there another step required? Have you verified that self.peopleArrayController is not nil? Regards, Ken ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com