IOHIDManagerRegisterDeviceMatchingCallback called twice when device pluggedin
Hi, I am using New IOHIDManager APIs, IOHIDManagerRegisterDeviceMatchingCallback and IOHIDManagerRegisterDeviceRemovalCallback to get notified for Pluggedin and Removed. Whenever I pluggin the device, I found that the DeviceMatchingCallback method called twice always. May I know what could be the reason? My HIDUtilities methods goes like this. and its usage is given below. //Usage. - (BOOL)connectHIDDeviceWithVendorId:(long)vendorID productID:(long)productID { BOOL tResult = NO; mHIDManagerRef = [HIDUtilities createHIDManager:Handle_IOHIDDevicePluggedInCallback inRemovalCallback:Handle_IOHIDDeviceRemovalCallback]; if(mHIDManagerRef) { mDeviceRef = [HIDUtilities findDevice:mHIDManagerRef vendorId:vendorID productId:productID]; tResult = (mDeviceRef != NULL); } return tResult; } + (IOHIDManagerRef)createHIDManager:(IOHIDDeviceCallback)inPluggedInCallback inRemovalCallback:(IOHIDDeviceCallback)inRemovalCallback { IOHIDManagerRef managerRef = NULL; IOReturn tIOReturn = kIOReturnSuccess; managerRef = IOHIDManagerCreate( kCFAllocatorDefault, kIOHIDOptionsTypeNone ); IOHIDManagerScheduleWithRunLoop( managerRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode ); IOHIDManagerRegisterDeviceMatchingCallback(managerRef, inPluggedInCallback, NULL); IOHIDManagerRegisterDeviceRemovalCallback(managerRef, inRemovalCallback, NULL); tIOReturn = IOHIDManagerOpen( managerRef, kIOHIDOptionsTypeNone ); if ( kIOReturnSuccess != tIOReturn ) { [HIDUtilities closeHIDManager:managerRef]; managerRef = NULL; } return managerRef; } + (void)closeHIDManager:(IOHIDManagerRef)inHIDManagerRef { IOHIDManagerRegisterDeviceMatchingCallback( inHIDManagerRef, NULL, NULL ); IOHIDManagerRegisterDeviceRemovalCallback( inHIDManagerRef, NULL, NULL ); IOHIDManagerUnscheduleFromRunLoop( inHIDManagerRef, CFRunLoopGetCurrent( ), kCFRunLoopDefaultMode ); IOHIDManagerClose( inHIDManagerRef, kIOHIDOptionsTypeNone ); } + (IOHIDDeviceRef)findDevice:(IOHIDManagerRef)inHIDManagerRef vendorId:(long)vendorId productId:(long)productId { IOHIDDeviceRef theDevice = NULL; // setup dictionary CFMutableDictionaryRef deviceIdentity = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks); CFNumberRef cfVendorId = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, vendorId); CFStringRef cfVendorSt = CFStringCreateWithCString(kCFAllocatorDefault, kIOHIDVendorIDKey, kCFStringEncodingUTF8); CFDictionaryAddValue(deviceIdentity, cfVendorSt, cfVendorId); CFRelease(cfVendorId); CFRelease(cfVendorSt); CFNumberRef cfProductId = CFNumberCreate(kCFAllocatorDefault, kCFNumberLongType, productId); CFStringRef cfProductSt = CFStringCreateWithCString(kCFAllocatorDefault, kIOHIDProductIDKey, kCFStringEncodingUTF8); CFDictionaryAddValue(deviceIdentity, cfProductSt, cfProductId); CFRelease(cfProductId); CFRelease(cfProductSt); //CFMutableDictionaryRef dictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks); //CFDictionaryAddValue(dictionary, CFSTR(kIOPropertyMatchKey), deviceIdentity); // look for devices matching criteria IOHIDManagerSetDeviceMatching(inHIDManagerRef, deviceIdentity); CFSetRef foundDevices = IOHIDManagerCopyDevices(inHIDManagerRef); CFIndex foundCount = 0; if(foundDevices) { foundCount = CFSetGetCount(foundDevices); NSLog(@FoundCount:[%d], foundCount); if(foundCount 0) { // get first matching device IOHIDDeviceRef *deviceRefs = malloc(sizeof(IOHIDDeviceRef *) * foundCount); CFSetGetValues(foundDevices, (const void **)deviceRefs); theDevice = deviceRefs[0]; CFRetain(theDevice); free(deviceRefs); } CFRelease(foundDevices); } CFRelease(deviceIdentity); return theDevice; } Regards Mustafa Shaik ___ 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: Interfacing cocoa/obj-c within a C plug-in API
On 22/12/2009, at 10:22 AM, Rich E wrote: Hi, I am new to Cocoa and Objective-C both, but I need the two in order to get tablet functionality into one of my favorite applications (Puredata) on Mac OS X. First off, I know that you can get tablet event data through the Carbon API, but I have ran into enough problems (along with no 64-bit support) that I think trying it with Cocoa is worth a shot. Puredata has an API for writing plug-in's in C and I hear that it is possible to write the entire plug-in in Obj-C but leave the host callback functions in standard C, yet I still don't understand how to embark. I learn best by examples, does anyone know of any existing C applications that make use of Cocoa or Objective-C? Else, any advice on how to combine these two with a host written in C? The Carbon Event stuff is available in 64-bit, as far as I'm aware. Cocoa is built on it, so these lower-level parts of Carbon are very likely to remain available in 64-bit. It's mostly the higher level stuff, such as UI and legacy managers that are unavailable. Objective-C is a strict superset of C, so it may be freely intermixed with C code with few special considerations. Source files containing any Objective-C would end in .m, whereas pure C would end in .c, but you can put whatever C code you want into a .m file and it will be compiled as you'd expect. So for a plug-in with a pure C application interface that can remain as normal, but if you want to call Obj-C methods internally just make the source files .m instead and link against the usual Cocoa frameworks, and it should work. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interfacing cocoa/obj-c within a C plug-in API
Le 22 déc. 2009 à 10:56, Graham Cox a écrit : On 22/12/2009, at 10:22 AM, Rich E wrote: Hi, I am new to Cocoa and Objective-C both, but I need the two in order to get tablet functionality into one of my favorite applications (Puredata) on Mac OS X. First off, I know that you can get tablet event data through the Carbon API, but I have ran into enough problems (along with no 64-bit support) that I think trying it with Cocoa is worth a shot. Puredata has an API for writing plug-in's in C and I hear that it is possible to write the entire plug-in in Obj-C but leave the host callback functions in standard C, yet I still don't understand how to embark. I learn best by examples, does anyone know of any existing C applications that make use of Cocoa or Objective-C? Else, any advice on how to combine these two with a host written in C? The Carbon Event stuff is available in 64-bit, as far as I'm aware. Cocoa is built on it, so these lower-level parts of Carbon are very likely to remain available in 64-bit. It's mostly the higher level stuff, such as UI and legacy managers that are unavailable. The fact that Cocoa uses a technology internally does not mean that it will remain an API. Most of Carbon event is SPI on 64 bits. Objective-C is a strict superset of C, so it may be freely intermixed with C code with few special considerations. Source files containing any Objective-C would end in .m, whereas pure C would end in .c, but you can put whatever C code you want into a .m file and it will be compiled as you'd expect. So for a plug-in with a pure C application interface that can remain as normal, but if you want to call Obj-C methods internally just make the source files .m instead and link against the usual Cocoa frameworks, and it should work. --Graham -- Jean-Daniel ___ 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: Interfacing cocoa/obj-c within a C plug-in API
On 22/12/2009, at 9:16 PM, Jean-Daniel Dupas wrote: The Carbon Event stuff is available in 64-bit, as far as I'm aware. Cocoa is built on it, so these lower-level parts of Carbon are very likely to remain available in 64-bit. It's mostly the higher level stuff, such as UI and legacy managers that are unavailable. The fact that Cocoa uses a technology internally does not mean that it will remain an API. Most of Carbon event is SPI on 64 bits. Ok, but the header CarbonEvents.h contains extensive commentary on its use with 64-bit. That suggests to me that most of it will remain available. Where unsupported, the APIs are marked as such. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Interfacing cocoa/obj-c within a C plug-in API
On 22.12.2009, at 00:22, Rich E wrote: I learn best by examples, does anyone know of any existing C applications that make use of Cocoa or Objective-C? Else, any advice on how to combine these two with a host written in C? As Graham said, since Objective C is based on plain C (even more so than C++, which, among other things, applies name mangling to functions unless you explicitly mark them as 'extern C'), it's fairly straightforward. Just make sure that the C functions the host application calls in your plug-in only take C types as parameters. But the plugin protocols usually do that already, so no worry. If you need to export a header to some C-only caller, you can use # if __OBJC__ to make sure it doesn't see any of your ObjC constructs (just like you would use #if __cplusplus to hide C++ constructs). The only issues you may have are Carbon/Cocoa integration issues, where the frameworks have different ways of doing things. E.g. it's not easy to put Cocoa sheets on Carbon windows or vice versa. You may want to look into Apples documentation, to make sure you take care of the staples, like - Call NSApplicationLoad() - catch any ObjC exceptions so they don't waltz through the C code - Create the requisite autorelease pools Cheers, -- Uli Kusterer The witnesses of TeachText are everywhere... ___ 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: NSTabView Bindings
On Dec 21, 2009, at 22:02, Gerriet M. Denkmann wrote: I am trying to bind editable of an NSTableColumn to ObjectController tabView.selectedIndex (The tab view has two items: Read and Edit. When the first item is selected, my table column should not be editable). But I am told: [NSTabView 0x10027d010 valueForUndefinedKey:]: this class is not key value coding-compliant for the key selectedIndex. On the other hand, the Cocoa Bindings Reference for NSTabView says: selectedIndex An integer value that specifies the index of the selected item in the NSTabView. When the selection changes in the NSTabView, this value is updated with the index of the newly selected item. So: what is going on? And: how do I make my table column editable if and only if the first tab view item is selected? selectedIndex is a binding, not a property. There is no NSTabView property that makes the selected tab index available directly. The simplest way to do this is probably to create an isFirstTabSelected property in your window controller (tracking changes to the tab view state), and bind the table column's editable binding to that property. ___ 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: Core Data _NSFaultingMutableSet Exception
On 22 Dec 2009, at 16:20, Jerry Krinock je...@ieee.org wrote: On 2009 Dec 21, at 21:05, Gerriet M. Denkmann wrote: But when I use: [ arrayController1 setFilterPredicate: aValue BEGINSWITH[n] a AND ANY theBs.bValue == xx]; I get an exeption: HIToolbox: ignoring exception '[_NSFaultingMutableSet 0x1001f5d00 addObserver:forKeyPath:options:context:] is not supported. Key path: bValue' that raised inside Carbon event dispatch I believe I've seen this message when I try to observe the many end of a to-many relation using KVO. That's against the law. (And I do remember reading that one in the documentation, mmalc!) Probably it was in the KVO Programming guide?? Bindings uses KVO. Clue: Look at any bindings hanging on that array controller. Well, this was an idea I had already. Because the old (working) app did just have an array controller, but the new app (the one throwing exceptions) had another array controller bound to the selection of the first one. So I did [ secondArrayController unbind: @contentSet ] - but no success. Then I removed the secondArrayController from the nib - no success either. Now, after reading your mail, I deleted the first array controller, dragged a new one into the nib - and everything works! Obviously the old firstArrayController had some memory of having its content bound to by some other controller; a memory persisting regardless of this binding having been unbound, or the binder having disappeared. I am not qualified to call this a bug. But it has cost me more than a day of pointless struggle. Is this persistent memory of NSArrayControllers somewhere documented? And is there a way (programmatically) to clear this unwanted memory? Thanks for your help! Kind regards, Gerriet. ___ 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
__CFServiceControllerBeginPBSLoadForLocalizations timed out
The last few days, I've seen this message in the console when I launch an app I'm working on: __CFServiceControllerBeginPBSLoadForLocalizations timed out while talking to pbs The message also sometimes appears again a few minutes later. It appears in the regular Console Messages in Console.app, not just in Xcode. Searching list archives shows other such reports in the last couple months, and a postulate that pbs means pasteboard server. So, I retested some of the inter-app drag/drop and copy/paste functions of the app but it all appears to still be working. Google Chrome has the same problem: http://code.google.com/p/chromium/issues/detail?id=28161 No resolution is given. I just tested this in my 3-week old Google Chrome and, yes, it still does it. I also found a few reports in support forums of other apps. And this person has got all of their Apple apps doing it… http://forums.applenova.com/showthread.php?t=33412 So, apparently it's a bug in Snow Leopard. No hits when searching for this on developer.apple.com :( Can anyone postulate a workaround or, more importantly, is it possibly indicating that something that I missed in my testing is not working? ___ 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 shortcuts without modifiers?
On 22.12.2009, at 02:35, Peter Ammon wrote: To get Carbon's notion of the focus, you can do this: HIViewRef focusedView = NULL; HIViewGetFocus(GetUserFocusWindow(), focusedView, NULL); To get Cocoa's notion, you would write: NSResponder *fr = [[NSApp keyWindow] firstResponder] The question of who really has the focus is a little complicated, because it depends on who is dispatching events. If you have a Carbon window in a Cocoa app, HIViewGetFocus() will normally give you a NULL view if a Cocoa window is focused, so you might start by checking with Carbon, and then checking with Cocoa if the Carbon focus is not a text field. Thank you! That seems to work pretty well. Now I only have to figure out a way to nicely disable the shortcut. Of course, I could remove it from the menu item, but it would be a little confusing to users if they don't see the shortcut.I'd be open for any suggestions. Cheers, -- Uli Kusterer The witnesses of TeachText are everywhere... ___ 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: UIImage and shadows, WAS: Re: Please if some one knows
Thanks alot, this got me started in the right direction. I still have fine tuning I need to do to get the size and draw point perfect but with some adjustments to the code I have it mostly working. if any one wants to see I can post the new code. On Dec 21, 2009, at 10:23 PM, Henry McGilton (Boulevardier) wrote: On Dec 21, 2009, at 8:02 PM, Development wrote: Then I don't understand how to do this. Do I create the context at this larger size? because that's what I did. Do I drawInRect the image at it's original size? Because that's what I did. As near as I can tell, no matter what I do, the image itself, not accounting for the shadow, is drawn in the upper left corner. this causes a negative shadow, or one to the upper left, to be cut off by the edge of the context. I have attempted using drawAtPoint, and accounting for the negative shadow by moving the point an amount that should accommodate the shadow. It did not work. Now if the shadow is to the lower right, the adjustments I make work perfectly every time and the shadow is exactly what it should be. I think the point is that I do not understand the context drawing. I thought I did but it should be painfully obvious from this thread that I do not. Are you aware that the context you get from UIGraphicsBeginImageContext has its origin at upper left ? In any case, I have posted a mini example that *appears* to do what you want, but based on the descriptions, I might have misunderstood, in which case please excuse me for wasting bandwidth . . . The project is here: http://www.trilithon.com/download/Shadow.zip Cheers, . . . . . . . .Henry On Dec 21, 2009, at 8:45 PM, Graham Cox wrote: On 22/12/2009, at 1:49 PM, Development wrote: however what I am getting now is a larger image, offset in the view and still cutting off the shadow. So I honestly do not know how I am suppose to draw this shadow. I would really be grateful for some additional direction. Try thinking instead of flailing about throwing code at it. You need a bigger image to accommodate the shadow. But the image you want to composite on top is the same size as it always was. So you need to keep its original size around so you can draw it at that size but into the larger image context. If you draw it at the new size you are back at square one, but larger. --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: http://lists.apple.com/mailman/options/cocoa-dev/appledeveloper%40trilithon.com This email sent to appledevelo...@trilithon.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImage and shadows, WAS: Re: Please if some one knows
On Dec 21, 2009, at 8:02 PM, Development wrote: As near as I can tell, no matter what I do, the image itself, not accounting for the shadow, is drawn in the upper left corner. this causes a negative shadow, or one to the upper left, to be cut off by the edge of the context. I have attempted using drawAtPoint, and accounting for the negative shadow by moving the point an amount that should accommodate the shadow. It did not work. Now if the shadow is to the lower right, the adjustments I make work perfectly every time and the shadow is exactly what it should be. I think the point is that I do not understand the context drawing. I thought I did but it should be painfully obvious from this thread that I do not. I highly suspect that your drawing is just fine, but since your not drawing to a view, but extracting an image that you are assigning to a UIImageView, your conditions are likely different from drawing to a typical view. A UIImageView, by default, centers its content. This means that if you have a UIImageView that is 20x20 in size, but you assign a 30x30 image to it, then (unless clipToBounds=YES) the image will still be displayed at 30x30 centered on the view. A plain UIView by default resizes its content. Normally this does not matter because you don't set the contents of a UIView's layer. But it does mean that you would typically resize the UIView in order to have it display more content, and thus you would still avoid the issue. Overall, this is one of those situations where, as others have commented, you need to figure out where things are going wrong before anyone can really help you. There are lots of ways to debug this, but especially the simulator can make this very convenient since it is much easier to get files off. Typically when debugging offscreen drawing the standard approach is to dump images of that drawing to disk periodically to see what is going on. In the simulator you can easily just grab a PNG representation and drop it at the root of your hard disk or home folder (whereas on hardware you have to put it in your documents folder and then download it). Doing so would tell you if your drawing is doing what you want and help you figure out where the actual problem is. -- David Duncan Apple DTS Animation and Printing ___ 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: UIImage and shadows, WAS: Re: Please if some one knows
I think I've gotten on the right track. Two issues. One I needed to add the spread * pi to the height and width. That made a huge difference. Thank you for the direction it helped a lot. Given the time to fine tune it exactly I think i might finally have this. I kind of didn't really realize it but you are actually working in side of a circle because the shadow offsets from the center of the image. Anyway that realization made a lot of difference. On Dec 22, 2009, at 8:28 AM, David Duncan wrote: On Dec 21, 2009, at 8:02 PM, Development wrote: As near as I can tell, no matter what I do, the image itself, not accounting for the shadow, is drawn in the upper left corner. this causes a negative shadow, or one to the upper left, to be cut off by the edge of the context. I have attempted using drawAtPoint, and accounting for the negative shadow by moving the point an amount that should accommodate the shadow. It did not work. Now if the shadow is to the lower right, the adjustments I make work perfectly every time and the shadow is exactly what it should be. I think the point is that I do not understand the context drawing. I thought I did but it should be painfully obvious from this thread that I do not. I highly suspect that your drawing is just fine, but since your not drawing to a view, but extracting an image that you are assigning to a UIImageView, your conditions are likely different from drawing to a typical view. A UIImageView, by default, centers its content. This means that if you have a UIImageView that is 20x20 in size, but you assign a 30x30 image to it, then (unless clipToBounds=YES) the image will still be displayed at 30x30 centered on the view. A plain UIView by default resizes its content. Normally this does not matter because you don't set the contents of a UIView's layer. But it does mean that you would typically resize the UIView in order to have it display more content, and thus you would still avoid the issue. Overall, this is one of those situations where, as others have commented, you need to figure out where things are going wrong before anyone can really help you. There are lots of ways to debug this, but especially the simulator can make this very convenient since it is much easier to get files off. Typically when debugging offscreen drawing the standard approach is to dump images of that drawing to disk periodically to see what is going on. In the simulator you can easily just grab a PNG representation and drop it at the root of your hard disk or home folder (whereas on hardware you have to put it in your documents folder and then download it). Doing so would tell you if your drawing is doing what you want and help you figure out where the actual problem is. -- David Duncan Apple DTS Animation and Printing ___ 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
Inspect Core Graphics Object
How do you inspect or print the description of a Core Graphics object? --Richard ___ 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
iPhone: Autorotation for a subview
I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. Eric ___ 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: Localization strategies?
Thank you all for the replies. Here's my final plan: (1) Have separate nibs for each language. I agree with those that say you cannot have a one-size-fits-all layout. Each nib will thus carry layout, font size, style, etc. that makes sense for a particular language. I've already pseudo-localized the nibs to hopefully address 90% plus of any truncation issues. (2) Externalize all strings from the nibs and put them into Localizable.strings. This allows me to have a single file to hand off to translators. I can also group like-items together and fill in nice contextual comments. Nibs will still contain text for buttons, etc. but will all be in the form {s} (a string wrapped in curly braces). (3) For runtime creation of fonts (e.g. boldSystemFontOfSize), call into my special Font factory. I ended up creating a fonts.plist localized file. Each version will contain two attributes per key (font size and whether or not its bold). At runtime, I now read in the appropriate plist and gather the metrics for the fonts I need to create. (4) Leverage my existing automated-test infrastructure to do a full product walkthrough (setting up proper data along the way) and generating screen-shots. Such screen shots can now be viewed by the localization company's QA team to ensure all text is valid within its context. Furthermore, the walkthrough script will mine all text on the screen and look for curly braces. That will mean that either an outlet isn't connected or its localized string key is either missing or malformed. The walkthrough script will also be generating HTML files (which will provide links to all screenshots). This will allow everyone to view screenshots side-by-side (comparing original English to a second language) Finally, here's some other things I have already done to ensure translation will be as smooth as possible: * No plural forms (while allowing plurals can be handled, it's not worth the effort IMO) * No fragmented sentences (i.e. pieces of sentences across multiple UI elements) * No hardcoded ordering of parameters. i.e. template strings like Blah {0} blah {1}. may be {1} blah blah {0} in other languages. Each placeholder is always matched to the appropriate vararg argument. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: Autorotation for a subview
What I have always had to do is rotate the new subview manually when it is added to the main view. I don't know if it's the right answer but it is what I've done. On Dec 22, 2009, at 10:51 AM, Eric E. Dolecki wrote: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. Eric ___ 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/development%40fornextsoft.com This email sent to developm...@fornextsoft.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone: Autorotation for a subview
On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. I assume you mean -willAnimateRotationToInterfaceOrientation:duration: which is a method on UIViewController, not UIView. If not, your signature is wrong and that method would never be called. You'll need to manage your subviews from the controller when it receives the message. That's what the controller is for: views themselves are not aware of rotations. Best, Hank ___ 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: iPhone: Autorotation for a subview
Well - the subView is really a settings view - so it can be called up at any time. And of course the user can rotate the device around while it's already being viewed. So I suppose I can call a method in my subview from the willAnimateRotationToInterfaceOrientation:duration in the UIViewController to have it lay itself out as needed. My subView is a view controller too. Eric On Tue, Dec 22, 2009 at 1:04 PM, Hank Heijink (Mailinglists) hank.l...@runbox.com wrote: On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. I assume you mean -willAnimateRotationToInterfaceOrientation:duration: which is a method on UIViewController, not UIView. If not, your signature is wrong and that method would never be called. You'll need to manage your subviews from the controller when it receives the message. That's what the controller is for: views themselves are not aware of rotations. Best, Hank -- http://ericd.net Interactive design and development ___ 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: iPhone: Autorotation for a subview
Ok - I am doing this in my view controller which works better: - (IBAction) displayInfo:(id)sender { myInfoView = [[InfoViewController alloc] initWithNibName:@InfoViewController bundle:[NSBundle mainBundle]]; myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); [self.view addSubview:myInfoView.view]; } But there is a button I'd like to move in the subView (in portrait its near the bottom, in Landscape it needs to move up into view). What's the best way of doing that? On Tue, Dec 22, 2009 at 1:05 PM, Eric E. Dolecki edole...@gmail.com wrote: Well - the subView is really a settings view - so it can be called up at any time. And of course the user can rotate the device around while it's already being viewed. So I suppose I can call a method in my subview from the willAnimateRotationToInterfaceOrientation:duration in the UIViewController to have it lay itself out as needed. My subView is a view controller too. Eric On Tue, Dec 22, 2009 at 1:04 PM, Hank Heijink (Mailinglists) hank.l...@runbox.com wrote: On Dec 22, 2009, at 12:51 PM, Eric E. Dolecki wrote: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. I assume you mean -willAnimateRotationToInterfaceOrientation:duration: which is a method on UIViewController, not UIView. If not, your signature is wrong and that method would never be called. You'll need to manage your subviews from the controller when it receives the message. That's what the controller is for: views themselves are not aware of rotations. Best, Hank -- http://ericd.net Interactive design and development -- http://ericd.net Interactive design and development ___ 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: iPhone and GC
On Mon, Dec 21, 2009 at 10:37 PM, Michael Ash michael@gmail.com wrote: On Tue, Dec 22, 2009 at 8:54 AM, Lorenzo Thurman lorenzo7...@gmail.com wrote: Why can't iPhone apps use GC? Is it resources? Performance? Some combination of the two or other reasons altogether? Just curious, thanks. I know that this will be unsatisfying, but the real reason that iPhone apps can't use GC is because Apple has not yet made GC available for the iPhone. Anything further would be pure speculation, because Apple doesn't talk about things like that. Actually, the documentation is quite specific on the subject. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/WhatIsCocoa/WhatIsCocoa.html#//apple_ref/doc/uid/TP40002974-CH3-SW76 iPhone OS Note: For performance reasons, garbage collection is not allowed in Cocoa applications running on iPhone OS. ___ 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
NSRecursiveLock problems
Lately I've been getting errors like these with my app: 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x20069d980 '(null)') unlocked when not locked 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on _NSLockError() to debug. 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock finalize]: lock (NSRecursiveLock: 0x20069dca0 '(null)') finalized while still in use 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on _NSLockError() to debug. As Greg Parker suggested in an earlier question, instead of putting a breakpoint on NSLockError (which doesn't work) I put a breakpoint on NSLog. And this is what the debugger looks like: http://img30.imageshack.us/img30/5894/screenshot20091222at114.png I dont see how any code in there has a connection to NSRecursiveLock. Independent Cocoa Developer, Macatomy Software http://macatomy.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRecursiveLock problems
Scrap that, I managed to find where the problem is happening. Debugger: http://img709.imageshack.us/img709/9758/screenshot20091222at115.png I didn't know that NSInvocationOperation used NSRecursiveLock. But this still doesn't really help me understand *why* I'm getting these errors. The use of NSInvocationOperation seems quite simple, so I'm not seeing where this is going wrong. You can see the code where I invoke the operation in the screenshot. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 11:49 AM, PCWiz wrote: Lately I've been getting errors like these with my app: 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x20069d980 '(null)') unlocked when not locked 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on _NSLockError() to debug. 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock finalize]: lock (NSRecursiveLock: 0x20069dca0 '(null)') finalized while still in use 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on _NSLockError() to debug. As Greg Parker suggested in an earlier question, instead of putting a breakpoint on NSLockError (which doesn't work) I put a breakpoint on NSLog. And this is what the debugger looks like: http://img30.imageshack.us/img30/5894/screenshot20091222at114.png I dont see how any code in there has a connection to NSRecursiveLock. Independent Cocoa Developer, Macatomy Software http://macatomy.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSRuleEditor: Criteria for new row
When I hit the + button on a row in NSRuleEditor, a new row is created. How can I take influence on the criteria used for that row. It seems NSRuleEditor defaults to selecting the first criterion sequentially from the list of possible values. I would much rather have the new row match the row where the + was clicked. Pierre - - - Houdah Software s. à r. l. http://www.houdah.com HoudahGeo: One-stop photo geocoding HoudahSpot: Powerful Spotlight frontend ___ 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: passing a method name?
On Tue, 22 Dec 2009 09:56:33 +1100, Graham Cox graham@bigpond.com said: Regarding the use of different completion methods based on manipulating some common root name, I think that's a bit strange, misguided even. But when the kind of situation that calls for it arises, it might seem very natural and elegant. I'm just suggesting that we not condemn an architecture out of hand merely because we've no experience of it. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ 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: Core Data _NSFaultingMutableSet Exception
Do you have an old, unfixed version of your nib in version control somewhere? (The answer should be yes; if not, you might want to reconsider your approach to version control for the sake of your own sanity.) If so, do the same thing you did, confirm that it causes the same problem, and send the old and new versions of the nib off to Apple in a bug. There have been instances of this before, where objects simply weren't written to anticipate a property changing more than once in the lifespan of that object. These cases are definitely bugs. --Kyle Sluder On Dec 22, 2009, at 7:56 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 22 Dec 2009, at 16:20, Jerry Krinock je...@ieee.org wrote: On 2009 Dec 21, at 21:05, Gerriet M. Denkmann wrote: But when I use: [ arrayController1 setFilterPredicate: aValue BEGINSWITH[n] a AND ANY theBs.bValue == xx]; I get an exeption: HIToolbox: ignoring exception '[_NSFaultingMutableSet 0x1001f5d00 addObserver:forKeyPath:options:context:] is not supported. Key path: bValue' that raised inside Carbon event dispatch I believe I've seen this message when I try to observe the many end of a to-many relation using KVO. That's against the law. (And I do remember reading that one in the documentation, mmalc!) Probably it was in the KVO Programming guide?? Bindings uses KVO. Clue: Look at any bindings hanging on that array controller. Well, this was an idea I had already. Because the old (working) app did just have an array controller, but the new app (the one throwing exceptions) had another array controller bound to the selection of the first one. So I did [ secondArrayController unbind: @contentSet ] - but no success. Then I removed the secondArrayController from the nib - no success either. Now, after reading your mail, I deleted the first array controller, dragged a new one into the nib - and everything works! Obviously the old firstArrayController had some memory of having its content bound to by some other controller; a memory persisting regardless of this binding having been unbound, or the binder having disappeared. I am not qualified to call this a bug. But it has cost me more than a day of pointless struggle. Is this persistent memory of NSArrayControllers somewhere documented? And is there a way (programmatically) to clear this unwanted memory? Thanks for your help! Kind regards, Gerriet. ___ 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/kyle.sluder%40gmail.com This email sent to kyle.slu...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autorotation for a subview
On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com said: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ 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: NSRecursiveLock problems
Hello, NSAttributedString has proven to be unsafe in many ways for use on a secondary thread in our own applications. We were trying to do much the same thing, get the size of a string from it. But it turns out (obviously in retrospect) that it needs to use the font/GUI systems to do this, which don't seem to be safe for use on secondary threads. My guess is that it's accessing locks in the Layout manager that aren't intended to be accessed from the non-main thread and causing this error. Unless someone else has more insight than I do, you'll have to come up with an alternative way to architect this - we had to do all our string measuring on the main thread. (We were actually getting occasional crashes from doing this on a secondary thread, maybe once every 30K strings or so) Hope that helps some, Chris Backas On Dec 22, 2009, at 1:49 PM, PCWiz wrote: Lately I've been getting errors like these with my app: 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x20069d980 '(null)') unlocked when not locked 2009-12-21 13:07:48.420 TwitMenu[2512:a0f] *** Break on _NSLockError() to debug. 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** -[NSRecursiveLock finalize]: lock (NSRecursiveLock: 0x20069dca0 '(null)') finalized while still in use 2009-12-21 13:07:48.437 TwitMenu[2512:4103] *** Break on _NSLockError() to debug. As Greg Parker suggested in an earlier question, instead of putting a breakpoint on NSLockError (which doesn't work) I put a breakpoint on NSLog. And this is what the debugger looks like: http://img30.imageshack.us/img30/5894/screenshot20091222at114.png I dont see how any code in there has a connection to NSRecursiveLock. Independent Cocoa Developer, Macatomy Software http://macatomy.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: http://lists.apple.com/mailman/options/cocoa-dev/chb%40infoplusonline.com This email sent to c...@infoplusonline.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSRecursiveLock problems
Yeah sounds like the exact same problem I'm having. The problems aren't consistent at all, it just happens once every few thousand strings. Is there any easy way to execute a portion of code on the main thread without going through the mess of delegates and selectors? Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 12:06 PM, Chris Backas wrote: Hello, NSAttributedString has proven to be unsafe in many ways for use on a secondary thread in our own applications. We were trying to do much the same thing, get the size of a string from it. But it turns out (obviously in retrospect) that it needs to use the font/GUI systems to do this, which don't seem to be safe for use on secondary threads. My guess is that it's accessing locks in the Layout manager that aren't intended to be accessed from the non-main thread and causing this error. Unless someone else has more insight than I do, you'll have to come up with an alternative way to architect this - we had to do all our string measuring on the main thread. (We were actually getting occasional crashes from doing this on a secondary thread, maybe once every 30K strings or so) Hope that helps some, Chris Backas ___ 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: passing a method name?
On Dec 22, 2009, at 12:58 PM, Matt Neuburg wrote: On Tue, 22 Dec 2009 09:56:33 +1100, Graham Cox graham@bigpond.com said: Regarding the use of different completion methods based on manipulating some common root name, I think that's a bit strange, misguided even. But when the kind of situation that calls for it arises, it might seem very natural and elegant. I'm just suggesting that we not condemn an architecture out of hand merely because we've no experience of it. m. And isn't even that uncommon - consider all the various kvc methods based on common name (as an example of manipulating a common root name for multiple purposes). And I've written menu validation code that manipulates the selector to figure out the name of the method to actually handle the validation (which is more of the completion method style thing - dynamically figure out what to call based on the SEL passed in)... Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ 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: Autorotation for a subview
On Dec 22, 2009, at 1:01 PM, Matt Neuburg wrote: On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com said: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Or just mark the subview as needing layout and then have the subview figure things out in layoutSubviews. Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! Mad, Bad, and Dangerous to Know ___ 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: NSRecursiveLock problems
On Dec 22, 2009, at 11:19 AM, PCWiz wrote: Is there any easy way to execute a portion of code on the main thread without going through the mess of delegates and selectors? Delegates have *nothing* to do with main thread execution. Selectors a bit orthogonal, too. If you want to execute something on the main thread, I would suggest using NSOperationQueue's notion of main queue and enqueuing an operation with a block: - (void)addOperationWithBlock:(void (^)(void))block Quite straightforward. b.bum ___ 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: NSRecursiveLock problems
Well what I meant by delegates and selectors was like the secondary thread calls a selector on the main thread (using performSelectorOnMainThread) but I guess I got a little confused there :) I would like to use blocks, however I'm using the 10.5 SDK so as far as I know blocks cannot be used. Is there a way to get performSelectorOnMainThread to return a value? That would solve my issue, because I could pass on the NSAttributedString to a method on the main thread that figures out the size and all, then returns the value. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 12:22 PM, Bill Bumgarner wrote: On Dec 22, 2009, at 11:19 AM, PCWiz wrote: Is there any easy way to execute a portion of code on the main thread without going through the mess of delegates and selectors? Delegates have *nothing* to do with main thread execution. Selectors a bit orthogonal, too. If you want to execute something on the main thread, I would suggest using NSOperationQueue's notion of main queue and enqueuing an operation with a block: - (void)addOperationWithBlock:(void (^)(void))block Quite straightforward. b.bum ___ 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: NSRecursiveLock problems
PCWiz wrote: I would like to use blocks, however I'm using the 10.5 SDK so as far as I know blocks cannot be used. Is there a way to get performSelectorOnMainThread to return a value? That would solve my issue, because I could pass on the NSAttributedString to a method on the main thread that figures out the size and all, then returns the value. Give performSelectorOnMainThread an object that has space for a result value. In olden days this was called a parameter block. -- GG ___ 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: NSRecursiveLock problems
So for example I could do performSelectorOnMainThread with an NSMutableArray, for example, then have the method add the result object to the array and return it? Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 1:29 PM, Greg Guerin wrote: I would like to use blocks, however I'm using the 10.5 SDK so as far as I know blocks cannot be used. Is there a way to get performSelectorOnMainThread to return a value? That would solve my issue, because I could pass on the NSAttributedString to a method on the main thread that figures out the size and all, then returns the value. Give performSelectorOnMainThread an object that has space for a result value. In olden days this was called a parameter block. -- GG ___ 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: NSRecursiveLock problems
PCWiz wrote: So for example I could do performSelectorOnMainThread with an NSMutableArray, for example, then have the method add the result object to the array and return it? As long as no other threads were doing anything with that array, I think that would work. Or define a very simple class with a couple of properties. The obvious advantage is that a class gives you precise control over mutability, thread-safety, types, etc. -- GG ___ 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: Autorotation for a subview
On Dec 22, 2009, at 11:01 AM, Matt Neuburg wrote: On Tue, 22 Dec 2009 12:51:35 -0500, Eric E. Dolecki edole...@gmail.com said: I have a view which controls it's UI when rotated. However, if there is a subView in place, it rotates and I'd like to control it's UI too. In my subView the willAnimateRotationToInterfaceOrientation doesn't get fired. I set up the shouldAutorotateToInterfaceOrientation. Does my main view need to call something in my subView to get this to work? I'd think the subView would get the event too but it doesn't. This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. A potentially better way to approach this is to look at the different roles and responsibilities of View Controllers and Views, and gain a clearer understanding of which class of objects does which job . . . Think of a View Controller as a View *Manager*.The dominant paradigm for presenting screens of content to users on the iPhone platform consists of a View Controller managing a single enclosing View which, including all of its sub-views, represents that screen of content. In general, try to have your UIViews perform just two responsibilities. First, and by far the most important, is drawing their content. Second is acting as a container into which other Views may be added as sub-views.A very distant third (which is why I said 'two' even though it makes me look as if I can't count) is handling events, which task is frequently better managed in the View Controller. The View Controller implements methods to manage rotation, so doing the work of View hierarchy layout and sub-view re-positioning and re-sizing in the View Controller makes more sense than pushing the job down into the sub-views. If the View Controller knows about its view's sub-views, it will then know about their positions and sizes, and can perform simple re-positioning and re-sizing to accomplish the job. Finally, please try to use naming schemes where names of objects bear at least a passing resemblance to what those objects actually are.I refer to the line of code that reads: myInfoView = [[InfoViewController alloc] The code leads one to believe that the class named InfoViewController is a sub-class of UIViewController.The variable name myInfoView leads one to believe on casual inspection (and without adequate context) that the variable references something that's a sub-class of UIView.Which is it ? List readers, many of whom are trying to help, would be less confused if reasonable naming schemes were employed. The statement in an earlier message: My subView is a view controller too. Can not possibly be the case.A sub-view implies it's a UIView, and a UIView can not be a UIViewController --- the two classes are on different branches of the class hierarchy, and neither of them even define protocols that the other could adopt . . . We had a thread on this list a couple of months ago where even some of the more high-powered members of the list had tied themselves in knots and were arguing at cross purposes because a poster asking for help had allocated a UIImageView but called it an image . . .If you're asking for help, please try to write code readable and understandable by other busy people . . . Cheers, . . . . . . . .Henry iPhone App Developer Education --- visit www.nonatomic-retain.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Are views active or inactive?
Hi. I realize this is a basic Cocoa question, but now that I need to know, I can't find the answer in the NSView or NSResponder docs. Do NSViews have the notion of being active or inactive? My app architecture requires that I be able to differentiate, at draw time, between a (custom) view that is in the frontmost window (and technically, has focus), and a similar custom view that is in a non-frontmost window. In my case, I have Tool objects (think of a line tool or rectangle tool in a drawing program). These are singleton objects in the app, and hence a line tool is shared among all document views. If the frontmost view is in the middle of a tool operation, and one of the inactive views updates its view, it shows the current tool drawing state (Tool objects get a chance to draw). I'd like for my custom view to not give the Tool an opportunity to draw when it is not focussed/frontmost. Thanks! -- 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: passing a method name?
On 23/12/2009, at 6:20 AM, glenn andreas wrote: But when the kind of situation that calls for it arises, it might seem very natural and elegant. I'm just suggesting that we not condemn an architecture out of hand merely because we've no experience of it. m. And isn't even that uncommon - consider all the various kvc methods based on common name (as an example of manipulating a common root name for multiple purposes). And I've written menu validation code that manipulates the selector to figure out the name of the method to actually handle the validation (which is more of the completion method style thing - dynamically figure out what to call based on the SEL passed in)... Yes, but this is still talking about something different from what the OP was (or appeared to be) suggesting. It's fine to CALL one of n methods based on a e.g. rootname + suffix(n), say. That's just a variation on table-based dispatch. What isn't fine is to pass (my own method name) to another method and have that single method take different branches according to it. That's just setting up an unnecessary dependency between two separate pieces of code that a) doesn't need to be there b) will make it difficult to debug and c) difficult to document. It's completely avoidable by factoring the code in a more logical way. If you find yourself needing to do this, it's simply telling you that the place where you decided to factor your code was badly chosen, or that you need to parameterise it more sensibly. This is exactly the sort of code smell we were always on the look out for at code reviews, and it was always avoidable. In every case, the revised code was more elegant, maintainable and straightforward. I don't believe there is a genuine case where it would be more natural and elegant to do this than to take a more conventional approach. I'm also unaware of any part of Cocoa doing this. Going back to the OP's post, he says: currently, i'm passing a string object so the called method will know which method had called it. That's not table-based dispatch, that's just bad programming. If he's not also passing a target, this doesn't sound like a completion method or callback, unless the target is implied to be the object's delegate or some other implied target. Until the OP clarifies what he meant, I'm taking it at face value, and this is a no-no. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: __CFServiceControllerBeginPBSLoadForLocalizations timed out
On Dec 22, 2009, at 6:20 AM, Jerry Krinock wrote: The last few days, I've seen this message in the console when I launch an app I'm working on: __CFServiceControllerBeginPBSLoadForLocalizations timed out while talking to pbs The message also sometimes appears again a few minutes later. It appears in the regular Console Messages in Console.app, not just in Xcode. Searching list archives shows other such reports in the last couple months, and a postulate that pbs means pasteboard server. So, I retested some of the inter-app drag/drop and copy/paste functions of the app but it all appears to still be working. Google Chrome has the same problem: http://code.google.com/p/chromium/issues/detail?id=28161 No resolution is given. I just tested this in my 3-week old Google Chrome and, yes, it still does it. I also found a few reports in support forums of other apps. And this person has got all of their Apple apps doing it… http://forums.applenova.com/showthread.php?t=33412 So, apparently it's a bug in Snow Leopard. No hits when searching for this on developer.apple.com :( Can anyone postulate a workaround or, more importantly, is it possibly indicating that something that I missed in my testing is not working?' pbs is used for Services and isn't related to drag and drop or copy and paste. Can you see if the pbs process is running? If so, what does sample show it's doing? If not, what happens if you run it directly: /System/Library/CoreServices/pbs ? Does it crash or complete successfully? Do you have any apps installed that attempt to modify Services (e.g. Service Scrubber)?___ 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: Autorotation for a subview
On Dec 22, 2009, at 2:15 PM, Henry McGilton (Boulevardier) wrote: This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. An NSNotification is not a sledgehammer. And letting interested listeners know that a certain key moment in the lifetime of the application has been reached, is not a mosquito. Indeed, this is why something like UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes the delegate or subclass instance is not the only interested party; the moment where didRotateFromInterfaceOrientation: arrives might be such a case. m. ___ 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: NSRuleEditor: Criteria for new row
On Dec 22, 2009, at 10:57 AM, Houdah - ML Pierre Bernard wrote: When I hit the + button on a row in NSRuleEditor, a new row is created. How can I take influence on the criteria used for that row. It seems NSRuleEditor defaults to selecting the first criterion sequentially from the list of possible values. I would much rather have the new row match the row where the + was clicked. Pierre Sorry, this isn't possible right now. ___ 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: __CFServiceControllerBeginPBSLoadForLocalizations timed out
On 2009 Dec 22, at 15:37, Peter Ammon wrote: Can you see if the pbs process is running? If so, what does sample show it's doing? Yes it is, and, not doing too much. I took this sample while my app was launching. It looked the same if sampled at another time, except 2765 samples instead of 2747. Sampling process 22608 for 3 seconds with 1 millisecond of run time between samples Sampling completed, processing symbols... Analysis of sampling pbs (pid 22608) every 1 millisecond Call graph: 2747 Thread_287412 DispatchQueue_1: com.apple.main-thread (serial) 2747 0x1cf5 2747 0x4b8d 2747 0x3ea5 2747 0x532e 2747 -[NSCondition wait] 2747 pthread_cond_wait$UNIX2003 2747 _pthread_cond_wait 2747 __semwait_signal 2747 Thread_287432 DispatchQueue_2: com.apple.libdispatch-manager (serial) 2747 start_wqthread 2747 _pthread_wqthread 2747 _dispatch_worker_thread2 2747 _dispatch_queue_invoke 2747 _dispatch_mgr_invoke 2747 kevent Total number in stack (recursive counted multiple, when =5): Sort by top of stack, same collapsed (when = 5): __semwait_signal2747 kevent2747 Do you have any apps installed that attempt to modify Services (e.g. Service Scrubber)? Hmmm. Not that I know of. Searched startup volume for Scrubber with Path Finder and didn't find any apps. But I do have lots of apps installed :) ___ 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: Inspect Core Graphics Object
On 23/12/2009, at 4:33 AM, Richard Somers wrote: How do you inspect or print the description of a Core Graphics object? Core Graphics objects don't really have descriptions. You can do a 'po the object' in gdb as usual, but you get just the class name and address, and no more. What do you need to know? --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Autorotation for a subview
Thanks all for the insight so far. I'm calling methods into the view - but I think I need to redo how it works. I am interested in NSNotification as I haven't used that yet. On Tue, Dec 22, 2009 at 6:37 PM, Matt Neuburg m...@tidbits.com wrote: On Dec 22, 2009, at 2:15 PM, Henry McGilton (Boulevardier) wrote: This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. An NSNotification is not a sledgehammer. And letting interested listeners know that a certain key moment in the lifetime of the application has been reached, is not a mosquito. Indeed, this is why something like UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes the delegate or subclass instance is not the only interested party; the moment where didRotateFromInterfaceOrientation: arrives might be such a case. m. ___ 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/edolecki%40gmail.com This email sent to edole...@gmail.com -- http://ericd.net Interactive design and development ___ 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: Autorotation for a subview
On Dec 22, 2009, at 3:37 pm, Matt Neuburg wrote: This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. An NSNotification is not a sledgehammer. And letting interested listeners know that a certain key moment in the lifetime of the application has been reached, is not a mosquito. Indeed, this is why something like UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes the delegate or subclass instance is not the only interested party; the moment where didRotateFromInterfaceOrientation: arrives might be such a case. Using a notification per se is not a sledgehammer. Setting up your own view to post notifications for this situation, however, almost certainly is (*insofar as it's possible to determine the OP's requirements, given the confused problem description...*). There is already a perfectly good mechanism for communicating changes about a device's orientation through an object that's in the best place to respond to such changes -- UIView*Controller*'s willAnimateRotationToInterfaceOrientation... et al. methods. On Dec 22, 2009, at 4:25 pm, Eric E. Dolecki wrote: I am interested in NSNotification as I haven't used that yet. It's not clear if you're trying to solve a problem or learn about iPhone OS programming in general. Unthinkingly chasing interesting API is not a particularly useful strategy for solving a problem. Per Henry's reply, you should properly describe what the task is you're trying to accomplish using terminology and conventions that will best help those trying to help you. Hint; this: - (IBAction) displayInfo:(id)sender { myInfoView = [[InfoViewController alloc] initWithNibName:@InfoViewController bundle:[NSBundle mainBundle]]; myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); [self.view addSubview:myInfoView.view]; } makes almost no sense. Using a view controller to instantiate a view to add as a subview of another view that is presumably managed by another view controller is not a supported pattern. You're also ignoring basic memory management guidelines, and will almost certainly be leaking both the view controller and its accompanying view. Adding notifications to this scenario will not end prettily. mmalc ___ 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: __CFServiceControllerBeginPBSLoadForLocalizations timed out
On Dec 22, 2009, at 3:52 PM, Jerry Krinock wrote: On 2009 Dec 22, at 15:37, Peter Ammon wrote: Can you see if the pbs process is running? If so, what does sample show it's doing? Yes it is, and, not doing too much. I took this sample while my app was launching. It looked the same if sampled at another time, except 2765 samples instead of 2747. Sampling process 22608 for 3 seconds with 1 millisecond of run time between samples Sampling completed, processing symbols... Analysis of sampling pbs (pid 22608) every 1 millisecond Call graph: 2747 Thread_287412 DispatchQueue_1: com.apple.main-thread (serial) 2747 0x1cf5 2747 0x4b8d 2747 0x3ea5 2747 0x532e 2747 -[NSCondition wait] 2747 pthread_cond_wait$UNIX2003 2747 _pthread_cond_wait 2747 __semwait_signal 2747 Thread_287432 DispatchQueue_2: com.apple.libdispatch-manager (serial) 2747 start_wqthread 2747 _pthread_wqthread 2747 _dispatch_worker_thread2 2747 _dispatch_queue_invoke 2747 _dispatch_mgr_invoke 2747 kevent Total number in stack (recursive counted multiple, when =5): Thanks, this seems like a bug in pbs or in something underneath it. You should be able to get the annoying log messages to stop by just running pbs directly: /System/Library/CoreServices/pbs . It should exit within a second or so and the log messages should be gone. Hope this helps, -Peter___ 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: Autorotation for a subview
I already stated (I believe) that I needed to redo the way this application is being constructed. In this way I'll have more direct access to subviews. I originally created another view controller with it's own nib and I was indeed loading it and using it as a subview to my main view. No leaks since it's removed itself from superview. In regards to the NSNotification, I look at that as a learning opportunity and not merely a way of throwing some code at a problem hoping it will make it work. I haven't ever used it before - I've only been part-timing iPhone apps for about 7 months now. It's fascinating and exciting and humbling when you're trying to do something and were unaware of the proper framework or methods to use. Eric On Tue, Dec 22, 2009 at 7:37 PM, mmalc Crawford mmalc_li...@me.com wrote: On Dec 22, 2009, at 3:37 pm, Matt Neuburg wrote: This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. An NSNotification is not a sledgehammer. And letting interested listeners know that a certain key moment in the lifetime of the application has been reached, is not a mosquito. Indeed, this is why something like UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes the delegate or subclass instance is not the only interested party; the moment where didRotateFromInterfaceOrientation: arrives might be such a case. Using a notification per se is not a sledgehammer. Setting up your own view to post notifications for this situation, however, almost certainly is (*insofar as it's possible to determine the OP's requirements, given the confused problem description...*). There is already a perfectly good mechanism for communicating changes about a device's orientation through an object that's in the best place to respond to such changes -- UIView*Controller*'s willAnimateRotationToInterfaceOrientation... et al. methods. On Dec 22, 2009, at 4:25 pm, Eric E. Dolecki wrote: I am interested in NSNotification as I haven't used that yet. It's not clear if you're trying to solve a problem or learn about iPhone OS programming in general. Unthinkingly chasing interesting API is not a particularly useful strategy for solving a problem. Per Henry's reply, you should properly describe what the task is you're trying to accomplish using terminology and conventions that will best help those trying to help you. Hint; this: - (IBAction) displayInfo:(id)sender { myInfoView = [[InfoViewController alloc] initWithNibName:@ InfoViewController bundle:[NSBundle mainBundle]]; myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin); [self.view addSubview:myInfoView.view]; } makes almost no sense. Using a view controller to instantiate a view to add as a subview of another view that is presumably managed by another view controller is not a supported pattern. You're also ignoring basic memory management guidelines, and will almost certainly be leaking both the view controller and its accompanying view. Adding notifications to this scenario will not end prettily. mmalc ___ 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/edolecki%40gmail.com This email sent to edole...@gmail.com -- http://ericd.net Interactive design and development ___ 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: Autorotation for a subview
On Dec 22, 2009, at 5:09 pm, Eric E. Dolecki wrote: I already stated (I believe) that I needed to redo the way this application is being constructed. In this way I'll have more direct access to subviews. I originally created another view controller with it's own nib and I was indeed loading it and using it as a subview to my main view. No leaks since it's removed itself from superview. If you're using the code as shown, I can almost guarantee you will be leaking. You don't show any code for releasing any previous instance of the view controller, so you'll be leaking that and so also its view. Please review: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html, and in particular Using Accessor Methods at http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447. And again, this is not how view controllers are intended to be used -- see http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html In regards to the NSNotification, I look at that as a learning opportunity and not merely a way of throwing some code at a problem hoping it will make it work. I haven't ever used it before - I've only been part-timing iPhone apps for about 7 months now. It's fascinating and exciting and humbling when you're trying to do something and were unaware of the proper framework or methods to use. A desire to learn is certainly an admirable trait. Given that the actual problem is still ill-specified, however, focussing on solving that issue would seem a more profitable strategy for now... mmalc ___ 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: __CFServiceControllerBeginPBSLoadForLocalizations timed out
On 2009 Dec 22, at 17:07, Peter Ammon wrote: You should be able to get the annoying log messages to stop by just running pbs directly: /System/Library/CoreServices/pbs . It should exit within a second or so and the log messages should be gone. Indeed, after doing this, I launched my app several times and no message was logged. However, with Google Chrome, actually it's helper, I got what seems like an even worse message -- 09/12/22 17:21:09 [0x0-0x1c58c57].com.google.Chrome[18055] 2009-12-22 17:21:09.188 Google Chrome Helper[18069:107] __CFServiceControllerBeginPBSLoadForLocalizations received error 1100 from bootstrap_look_up2 Still, re-launching my app, it's quiet. And I presume from Peter's reply that this message does not predict any bad behavior in my app. So if anyone complains I'll tell them to just ignore it or run /System/Library/CoreServices/pbs. Maybe if someone from Google is this they can do some work on this in their 20% time :) ___ 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: NSRecursiveLock problems
I think I have actually found a one line solution for this problem. The issue class in my case is NSLayoutManager. I dug through the docs for NSLayoutManager and read the section on thread safety. There were 2 steps to achieving thread safety with NSLayoutManager. First, if the NSLayoutManager belonged to an NSTextView, then the text view must not be displayed while a secondary thread is making changes using its layout manager. The second part was to turn off background layout for the NSLayoutManager. In my case the layout manager was not tied to a text view (I was just using it to get the size of an attributed string) so all I had to do was this: [layoutManager setBackgroundLayoutEnabled:NO]; And that seemed to cure it. I'm not 100% sure if the problem is gone yet, but I've left it running for about an hour, and the issue would have usually appeared by now. I'll post back if it goes wrong again. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-22, at 2:19 PM, Greg Guerin wrote: PCWiz wrote: So for example I could do performSelectorOnMainThread with an NSMutableArray, for example, then have the method add the result object to the array and return it? As long as no other threads were doing anything with that array, I think that would work. Or define a very simple class with a couple of properties. The obvious advantage is that a class gives you precise control over mutability, thread-safety, types, etc. -- GG ___ 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/pcwiz.support%40gmail.com This email sent to pcwiz.supp...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data registered editors?
I noticed that NSPersistentDocument's docs for isDocumentEdited talks about editors registered with the managed object context. Is there something that explains what a registered editor is? 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data registered editors?
On Tue, Dec 22, 2009 at 9:33 PM, Rick Mann rm...@latencyzero.com wrote: I noticed that NSPersistentDocument's docs for isDocumentEdited talks about editors registered with the managed object context. Is there something that explains what a registered editor is? See the docs about NSEditorRegistration protocol: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSEditorRegistration_Protocol/Reference/Reference.html - Jim ___ 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: Core Data registered editors?
On Dec 22, 2009, at 19:13:50, Jim Correia wrote: On Tue, Dec 22, 2009 at 9:33 PM, Rick Mann rm...@latencyzero.com wrote: I noticed that NSPersistentDocument's docs for isDocumentEdited talks about editors registered with the managed object context. Is there something that explains what a registered editor is? See the docs about NSEditorRegistration protocol: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSEditorRegistration_Protocol/Reference/Reference.html Thanks! ___ 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: passing a method name?
On Tue, Dec 22, 2009 at 5:22 PM, Graham Cox graham@bigpond.com wrote: This is exactly the sort of code smell we were always on the look out for at code reviews, and it was always avoidable. In every case, the revised code was more elegant, maintainable and straightforward. I don't believe there is a genuine case where it would be more natural and elegant to do this than to take a more conventional approach. I'm also unaware of any part of Cocoa doing this. See -[NSControl tag] for an example of where it's done in Cocoa. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: passing a method name?
On Tue, Dec 22, 2009 at 9:28 PM, Kyle Sluder kyle.slu...@gmail.com wrote: See -[NSControl tag] for an example of where it's done in Cocoa. Didn't finish my sentence. Specifically it is done with the tag by -[NSTextView performFindPanelAction:]. It's not quite using the caller's selector, but it is funneling quite a few different code paths through the same method. Personally, I don't like it at all. I wish they were just separate methods. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are views active or inactive?
On Tue, Dec 22, 2009 at 4:16 PM, Rick Mann rm...@latencyzero.com wrote: Do NSViews have the notion of being active or inactive? My app architecture requires that I be able to differentiate, at draw time, between a (custom) view that is in the frontmost window (and technically, has focus), and a similar custom view that is in a non-frontmost window. Listen for NSWindowDidBecomeMainNotification. -viewDidMoveToWindow is a good time to start, and -viewWillMoveToWindow: is a good time to stop. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are views active or inactive?
On Dec 22, 2009, at 19:41:06, Kyle Sluder wrote: On Tue, Dec 22, 2009 at 4:16 PM, Rick Mann rm...@latencyzero.com wrote: Do NSViews have the notion of being active or inactive? My app architecture requires that I be able to differentiate, at draw time, between a (custom) view that is in the frontmost window (and technically, has focus), and a similar custom view that is in a non-frontmost window. Listen for NSWindowDidBecomeMainNotification. -viewDidMoveToWindow is a good time to start, and -viewWillMoveToWindow: is a good time to stop. I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. I'm not sure viewDidMoveToWindow works here. I'm using it already for something else, and it gets called 3 times when my window is created, but never when activated. -- 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are views active or inactive?
On Dec 22, 2009, at 10:45 PM, Rick Mann wrote: I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. AppKit views don’t have a native active/inactive status like carbon HIToolbox controls. For views which alter their appearance based on whether or not they are first responder, or in a key/main window, you must track this state yourself. I'm not sure viewDidMoveToWindow works here. I'm using it already for something else, and it gets called 3 times when my window is created, but never when activated. You can use viewWill/DidMoveToWindow to stop observing notifications on your preview window (if any) and start observing notifications on your new container window (if any), not for the tracking of the “active” state itself. - Jim ___ 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: Are views active or inactive?
On Tue, Dec 22, 2009 at 9:45 PM, Rick Mann rm...@latencyzero.com wrote: I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. Views don't become (in)active, windows do. Since there are plenty of things that might be interested in that (Window menu, controllers, views…), it's done as a notification so all interested parties can listen for it. I'm not sure viewDidMoveToWindow works here. I'm using it already for something else, and it gets called 3 times when my window is created, but never when activated. This surprises you? It's called -viewDidMoveToWindow after all. You would start listening for all window change notifications there, and then your view's notification handler would check to see if its window is the one being notified about and update its drawing accordingly. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are views active or inactive?
On Dec 22, 2009, at 19:48:53, Jim Correia wrote: On Dec 22, 2009, at 10:45 PM, Rick Mann wrote: I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. AppKit views don’t have a native active/inactive status like carbon HIToolbox controls. For views which alter their appearance based on whether or not they are first responder, or in a key/main window, you must track this state yourself. Dumb. I'm not sure viewDidMoveToWindow works here. I'm using it already for something else, and it gets called 3 times when my window is created, but never when activated. You can use viewWill/DidMoveToWindow to stop observing notifications on your preview window (if any) and start observing notifications on your new container window (if any), not for the tracking of the “active” state itself. Problem still remains that it gets called 3 times. I just found out I was creating 3 tracking areas. Not sure if the willMoveToWindow is called in between. -- 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Are views active or inactive?
On Dec 22, 2009, at 19:51:03, Kyle Sluder wrote: On Tue, Dec 22, 2009 at 9:45 PM, Rick Mann rm...@latencyzero.com wrote: I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. Views don't become (in)active, windows do. Since there are plenty of things that might be interested in that (Window menu, controllers, views…), it's done as a notification so all interested parties can listen for it. I'm not against the notification, I just think NSView should have an active property. Views do become inactive (look at any well-designed control). ___ 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: Localization strategies?
On Tue, Dec 22, 2009 at 11:54 AM, Ricky Sharp rsh...@mac.com wrote: (1) Have separate nibs for each language. I agree with those that say you cannot have a one-size-fits-all layout. Each nib will thus carry layout, font size, style, etc. that makes sense for a particular language. Luckily this isn't always necessary. But there's no substitute for when it is. (2) Externalize all strings from the nibs and put them into Localizable.strings. This allows me to have a single file to hand off to translators. I can also group like-items together and fill in nice contextual comments. This shouldn't be necessary; see man ibtool for arguments you can use to generate strings files from your nibs automatically. (3) For runtime creation of fonts (e.g. boldSystemFontOfSize), call into my special Font factory. I ended up creating a fonts.plist localized file. Each version will contain two attributes per key (font size and whether or not its bold). At runtime, I now read in the appropriate plist and gather the metrics for the fonts I need to create. Eeeenteresting. (4) Leverage my existing automated-test infrastructure to do a full product walkthrough (setting up proper data along the way) and generating screen-shots. Such screen shots can now be viewed by the localization company's QA team to ensure all text is valid within its context. Furthermore, the walkthrough script will mine all text on the screen and look for curly braces. That will mean that either an outlet isn't connected or its localized string key is either missing or malformed. Also enteresting. * No plural forms (while allowing plurals can be handled, it's not worth the effort IMO) Don't cop out with text like One or more items… or There are 5 document(s) open. That looks unprofessional and very un-Mac. * No fragmented sentences (i.e. pieces of sentences across multiple UI elements) Is this going to work in Preference panes? If you're already going the multiple-nib route, does doing this really pose a problem? * No hardcoded ordering of parameters. i.e. template strings like Blah {0} blah {1}. may be {1} blah blah {0} in other languages. Each placeholder is always matched to the appropriate vararg argument. NSString has support for this with the syntax Blah %1$@ blah %2$@. Bizarrely, it starts at 1, not 0. My $0.02. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Migration
Oh sorry, forgot to 'reply all' my bad. Thanks, Chaitanya Pandit Expersis Software Inc. On Dec 22, 2009, at 7:12 PM, Jerry Krinock wrote: On 2009 Dec 21, at 23:16, Chaitanya Pandit wrote: Hi jerry, I think what i'll have to do is if the user closes the doc without saving, just replace the new someDoc with ~someDoc and delete the ~someDoc so that it can still be opened by the older app, So you are getting the tilde docs. That's good. as my older app doesn't know how to deal with the ~ thing I'm disappointed that Apple did not build that ingelligence in, as I had postulated: On Dec 22, 2009, at 7:26 AM, Jerry Krinock wrote: Also, I've never tried to open such a migrated document with an earlier app version, but it would make sense that the earlier version would look for and automatically load the old tilde document if it couldn't load the current document due to model changed. I don't see why it wouldn't do that for you. You should file a bug. ___ 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: Inspect Core Graphics Object
On Dec 22, 2009, at 9:33 AM, Richard Somers wrote: How do you inspect or print the description of a Core Graphics object? There's no analogue to the -description method of Objective-C frameworks. Many of the specific Core Graphics types like CGColor and CGColorSpace and CGImage and CGFont have various 'Get . . .' function calls that provide sundry information about the object (CGColorGetComponents on CGColor, for instance).For CGPath, there's a CGPathApply by which you can play back the elements of the path, and so on. You have to look at the stuff on a case-by-case basis . . . Cheers, . . . . . . . .Henry iPhone App Developer Education --- visit www.nonatomic-retain.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
storing ivars in core data docs
Hello, is there a way to store regular ivars in docs of a core data doc-based applictions? Rainer ___ 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: Are views active or inactive?
On 22 dec 2009, at 19.45, Rick Mann wrote: Do NSViews have the notion of being active or inactive? My app architecture requires that I be able to differentiate, at draw time, between a (custom) view that is in the frontmost window (and technically, has focus), and a similar custom view that is in a non-frontmost window. Listen for NSWindowDidBecomeMainNotification. -viewDidMoveToWindow is a good time to start, and -viewWillMoveToWindow: is a good time to stop. I'm listening for that notification. Sure is a clunky way to do things. I've never used a view framework that didn't tell views when they became active/inactive. Lot's of interesting advice in this thread... :-) You don't have to listen to any notifications to achieve this. You will be asked to draw when the state of the window changes, and when you become or resign first responder status. So, you don't have to figure out *when* to draw, but you do have to figure out *how* to draw. Here are two things that you're often interested in taking into account: * Is your window the key window ([NSApp keyWindow] == [self window]) * Are you the first responder of that window ([[self window] firstResponder] == self) You can of course also track the state of these properties at all times using notifications and overrides of methods from your superclasses, but there is - like I said earlier - in general no need to. j o a r ___ 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
Modal Windows
Hello, I'm new here. I have a problem. I have two window, main window, and another window call NSWindow *cargaCaracteristicasHormigon; when I would like to see them, press a bottom there, and it's no problem: -(IBAction)showCaracteristicasHormigonSheet:(id)sender{ if (piezaSeleccionada-1) { float f; int i=0; for(Hormigon *h in armadoPrincipal.geometriaPrincipal.claseDeHormigon) { if (i==piezaSeleccionada) { f=h.fck; } i++; } [fckString setFloatValue:f]; [NSApp beginSheet:cargaCaracteristicasHormigon modalForWindow:[inPinta window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; } } this is ok. but when I would like to get this window make a click in a view I have the follow error: 2009-12-23 00:08:10.482 Secciones[1682:a0f] *** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], /SourceCache/AppKit/AppKit-1038.25/AppKit.subproj/NSApplication.m:3100 2009-12-23 00:08:10.483 Secciones[1682:a0f] Modal session requires modal window the code that I try is this: -(void)mouseDown:(NSEvent *)theEvent{ if (pintarRectangulo) { if (inicio) { path=[[NSBezierPath alloc] init]; puntoInicial=[theEvent locationInWindow]; [path moveToPoint:[theEvent locationInWindow]]; inicio=!inicio; }else { puntoFinal=[theEvent locationInWindow]; [path lineToPoint:NSMakePoint(puntoFinal.x, puntoInicial.y)]; [path lineToPoint:puntoFinal]; [path lineToPoint:NSMakePoint(puntoInicial.x, puntoFinal.y)]; [path lineToPoint:puntoInicial]; inicio=true; Hormigon *h=[[Hormigon alloc] initWithFck:30.0]; NSString *s=[[NSString alloc] init]; s=@pieza; [NSApp beginSheet:cargaCaracteristicasHormigon modalForWindow:[inPinta window] modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; [armadoPrincipal.geometriaPrincipal addGeometria:path tipoDeGeometria:s claseDeHormigon:h]; pintarRectangulo=!pintarRectangulo; } }else { piezaSeleccionada=rectanguloSeleccionado; } [self setNeedsDisplay:YES]; } Could help me anybody?, Please.___ 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
NSViewAnimationFadeInEffect broken in Snow Leopard?
NSViewAnimationFadeInEffect doesn't seem to be working like it was in Leopard. Here's an older project (not mine) to test: http://www.noodlesoft.com/blog/2007/09/03/animation-in-the-time-of-tiger-part-2/ When fading from one view to another, the fade out works, but the fade in doesn't. The view just shows immediately. Here's my own test project that is as simple as I can get: http://www.kainjow.com/code/FadeViewAnimation.zip Works fine in Leopard, but not in Snow Leopard. Any ideas? Yes, I could use Core Animation but would rather not change all my code at this point. Thanks, Kevin___ 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
Virtual Folders in Mac
Hi All, Is there a way to get a virtual folder in mac? Something like the win 7 library folder? Basically I am trying to create a folder in which if a file is copied or dragged, it creates a link to the original file into the folder instead of copying the file. I saw that Burn folder is something similar. But I dont want the burn button in it and would like to create symbolic link instead of alias in the folder since I can access the path of the original file using readlink or stat functions. Regards, Akash Nemani Computer Engineering School of Computing National University of Singapore ___ 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
Releasing Objects
Hi folks, I'm new to Cocoa but I think I have a passable understanding of Obj-C. I'm learning Cocoa for a part of an undergraduate comp-sci independent project. I'm working through the Cocoa Application Tutorial, found here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/01Introduction.html At the point where the tutorial discusses garbage collection (end of ch. 5), I decided to implement the deallocation of the Converter objects created by ConverterController's convert: method. I want the deallocation to happen inside convert:. To test it, I'm using [converter retainCount], thinking that after the object is deallocated, that call will cause an error. First I tried [converter release], which didn't work. My code for convert: looks like this: -(IBAction) convert: (id) sender { float amount; converter = [[Converter alloc] init]; [converter setSourceCurrencyAmount: [dollarField floatValue]]; [converter setRate: [rateField floatValue]]; amount = [converter convertCurrency]; [rateField selectText: self]; // autorelease ineff. if b4 this line. hmmm. [amountField setFloatValue: amount]; NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); [converter release]; NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); } Everything else is the same as is given in the tutorial. The console shows that the reference count of converter is 1 both before and after the release. Why? Next I tried using an autorelease pool inside the convert method. My code for convert: looks like this: -(IBAction) convert: (id) sender { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; float amount; converter = [[Converter alloc] init]; [converter setSourceCurrencyAmount: [dollarField floatValue]]; [converter setRate: [rateField floatValue]]; amount = [converter convertCurrency]; [amountField setFloatValue: amount]; [rateField selectText: self]; [converter autorelease]; NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); [pool drain]; NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); } Once again, everything else is the same. Now it works: and the console shows that the ref count is 1 before the pool drain and then there's an error (EXC_BAD_ACCESS). HOWEVER: If the [converter autorelease] call is moved up so it happens anywhere prior to the [rateField selectText: self] call, it doesn't work. The console now shows a ref count of 1 both before and after the pool drain. Once again, why? If I'm missing some key concept here, just point me in the right direction and I'll go learn it. If it's something more specific, fill me in! Thanks, Michael S Craig ___ 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: Modal Windows
On Dec 22, 2009, at 3:21 PM, Joaquín Sánchez wrote: 2009-12-23 00:08:10.483 Secciones[1682:a0f] Modal session requires modal window This happens when in IB you drop in an NSWindow instance, and then change the class to NSPanel, versus creating an NSPanel instance in the first place. My guess (I didn't bother to check) is that this is because IB didn't set - [NSPanel setWorksWhenModal:YES]. Just add that, or recreate the window in IB as an NSPanel to begin with and you should be fine. -- Seth Willits ___ 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: NSViewAnimationFadeInEffect broken in Snow Leopard?
On Dec 22, 2009, at 4:58 PM, Kevin Wojniak wrote: NSViewAnimationFadeInEffect doesn't seem to be working like it was in Leopard. Works fine in Leopard, but not in Snow Leopard. I had this same problem recently but didn't go back to Leopard to verify it. Fade out worked fine, but fade in was broken. Seems like I'm not the only one who had that problem :-\ -- Seth Willits ___ 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: NSViewAnimationFadeInEffect broken in Snow Leopard?
I just tried doing that the other day, and it just appeared suddenly, so I assumed I was doing something wrong. In the end I needed to program it differently because I needed to reverse the showing/hiding animation part way through the animation, so I never really looked into it in depth, but as a data point, it did appear to be broken to me. HTH Gideon On 23/12/2009, at 10:58 AM, Kevin Wojniak wrote: NSViewAnimationFadeInEffect doesn't seem to be working like it was in Leopard. ...___ 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: NSViewAnimationFadeInEffect broken in Snow Leopard?
Hmmm - seems as if there really is a bug there. One thing that surprised me in the documentation is that it explicitly says that the Hidden property is only set to false at the end of the animation. If the effect is to fade in an initially hidden view and the end frame is non-empty, the view is unhidden at the end. If the animation is done using an animation backing and setAlphaValue:, and setHidden:NO is only called at the end of the animation, then that would explain the bug. You could try setAlphaValue:0.0f and setHidden:NO before calling the animation and seeing whether that works around it. Gideon I had this same problem recently but didn't go back to Leopard to verify it. Fade out worked fine, but fade in was broken. Seems like I'm not the only one who had that problem :-\ ___ 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: Releasing Objects
On Dec 22, 2009, at 9:40 PM, Michael Craig wrote: NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); [converter release]; NSLog(@Reference count: %lx, (unsigned long) [converter retainCount]); If the -release is going to deallocate converter, then the subsequent -retainCount's behavior is undefined. b.bum ___ 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: Releasing Objects
On 23/12/2009 06:40, Michael Craig wrote: Everything else is the same as is given in the tutorial. The console shows that the reference count of converter is 1 both before and after the release. Why ? You said that you're using garbage collection. When using GC retain and release messages do nothing, and the retain count is not used to determine when an objet can be freed from memory. ___ 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