Re: Custom time picker
Hi Eric, When creating similar controls in the past (I am actually making an odometer style view right now), I have found that collection views work really well. There is a delegate call (something like proposedOffset:forTargetOffset:) which gives you the sticky behavior you desire... Thanks, Jon Sent from my iPhone > On Dec 2, 2015, at 4:22 PM, Eric Dolecki <edole...@gmail.com> wrote: > > I need to create a time picker control but don't have much vertical room. So > buttons above and below to affect hours, min, am/pm are out. I was thinking > swipes up and down. Best to use 3 UIScrollviews? Inertia is there. Only thing > is how to get the numbers to "stick" in selection position while still > allowing for smooth scrolling with quick flicking. Technique for that? > Is this a good solution? Anything I might consider? > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/jhull%40gbis.com > > This email sent to jh...@gbis.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString stringByAbbreviatingWithTildeInPath and Sandboxing
On Mar 5, 2015, at 2:29 PM, Jens Alfke j...@mooseyard.com wrote: I wouldn’t expect a response from Apple in ‘only’ a month, except perhaps to notify you that it’s a duplicate. If they do fix the bug, you won’t get a notification until there’s a developer release of the OS update so you can test the fix. And since this is a pretty minor bug in the grand scheme of things, I wouldn’t expect a fix in a dot-dot release. So I’d be guessing the earliest you might hear back about a fix is around WWDC (June?) when there’s hypothetically a DP of 10.11. Until then you’ll need to work around it. Okay, thanks. I guess I was expecting at least a “we’re looking into this” or “we won’t touch this” sort of reply. I think I can find a workaround for 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString stringByAbbreviatingWithTildeInPath and Sandboxing
That bug has gotten no response whatsoever from Apple. Any advice on how to proceed? On Feb 4, 2015, at 1:19 PM, Jon Baumgartner j...@bergenstreetsoftware.com wrote: I filed a radar: rdar://19716583 On 1/29/2015 10:55 AM, Kyle Sluder wrote: Even in a sandbox, you can get the user’s home directory using getpwuid(3) as mentioned in the docs: https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/DesigningYourSandbox/DesigningYourSandbox.html So you could just search through your string and replace occurrences of that with a tilde, but then you have to worry about encodings and all that muck. Since there’s no security risk here, it’s reasonable to ask that the existing API work in a sandbox too. --Kyle Sluder On Jan 29, 2015, at 7:45 AM, Jon Baumgartner j...@bergenstreetsoftware.com wrote: I’m happy to do this, but is this really a bug? I was just thinking there might be an alternate way to accomplish this. On 1/27/2015 4:03 PM, Kyle Sluder wrote: Could you please file a Radar describing your use case and share the number here? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString stringByAbbreviatingWithTildeInPath and Sandboxing
I filed a radar: rdar://19716583 On Thu, Jan 29, 2015 at 10:55 AM, Kyle Sluder k...@ksluder.com wrote: Even in a sandbox, you can get the user’s home directory using getpwuid(3) as mentioned in the docs: https://developer.apple.com/library/mac/documentation/Security/Conceptual/AppSandboxDesignGuide/DesigningYourSandbox/DesigningYourSandbox.html So you could just search through your string and replace occurrences of that with a tilde, but then you have to worry about encodings and all that muck. Since there’s no security risk here, it’s reasonable to ask that the existing API work in a sandbox too. --Kyle Sluder On Jan 29, 2015, at 7:45 AM, Jon Baumgartner j...@bergenstreetsoftware.com wrote: I’m happy to do this, but is this really a bug? I was just thinking there might be an alternate way to accomplish this. On 1/27/2015 4:03 PM, Kyle Sluder wrote: Could you please file a Radar describing your use case and share the number here? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString stringByAbbreviatingWithTildeInPath and Sandboxing
I’m happy to do this, but is this really a bug? I was just thinking there might be an alternate way to accomplish this. On 1/27/2015 4:03 PM, Kyle Sluder wrote: Could you please file a Radar describing your use case and share the number here? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSString stringByAbbreviatingWithTildeInPath and Sandboxing
Yeah. The app is specifically for copying paths, and applying various transformations to the path. Developers use it but also general users. On January 27, 2015 at 2:03:46 PM EST, Jens Alfke j...@mooseyard.com wrote:On Jan 27, 2015, at 9:20 AM, Jon Baumgartner j...@bergenstreetsoftware.com wrote: So how do I get /Users/current_user/file.txt to output as ~/file.txt when my app is sandboxed?Why do you need it to? That’s not the kind of path you should be displaying in the UI, because it won’t make sense to anyone but geeks. Is this a developer-focused app? —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSString stringByAbbreviatingWithTildeInPath and Sandboxing
My app uses this call, and it worked fine until I sandboxed it. The documentation for this call says: For sandboxed apps in OS X, the current home directory is not the same as the user’s home directory. For a sandboxed app, the home directory is the app’s home directory. So if you specified a path of /Users/current_user/file.txt for a sandboxed app, the returned path would be unchanged from the original. However, if you specified the same path for an app not in a sandbox, this method would replace the /Users/current_user portion of the path with a tilde. So how do I get /Users/current_user/file.txt to output as ~/file.txt when my app is sandboxed? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Trouble with services
On Aug 1, 2014, at 3:01 AM, Kyle Sluder k...@ksluder.com wrote: On Jul 31, 2014, at 9:11 PM, Ken Thomases k...@codeweavers.com wrote: You probably want lsregister. /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister First, I'd try lsregister -f /path/to/NewVersion.app. If that doesn't change the behavior, you can do lsregister -u /path/to/OldVersion.app. Also, Launch Services supposedly picks the bundle with the highest CFBundleVersion. So make sure that differs between all the versions you have installed. Thanks, guys. Unfortunately, neither of the lsregister commands worked. I even rebooted in between. My CFBundleVersion was unchanged (oops!), so I updated that, but it’s still insisting on opening the old one! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Trouble with services
Weird. I tried that. Still no go. I ended up having to delete that archive (I didn’t need it anyway) and now it’s correctly firing up my current development copy. On Aug 1, 2014, at 11:21 AM, SevenBits sevenbitst...@gmail.com wrote: On Aug 1, 2014, at 11:18 AM, Jon Baumgartner j...@bergenstreetsoftware.com wrote: On Aug 1, 2014, at 3:01 AM, Kyle Sluder k...@ksluder.com wrote: On Jul 31, 2014, at 9:11 PM, Ken Thomases k...@codeweavers.com wrote: You probably want lsregister. /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister First, I'd try lsregister -f /path/to/NewVersion.app. If that doesn't change the behavior, you can do lsregister -u /path/to/OldVersion.app. Also, Launch Services supposedly picks the bundle with the highest CFBundleVersion. So make sure that differs between all the versions you have installed. Thanks, guys. Unfortunately, neither of the lsregister commands worked. I even rebooted in between. My CFBundleVersion was unchanged (oops!), so I updated that, but it’s still insisting on opening the old one! Is it possible to maybe clear the derived data and rebuild your app with the updated CFBundleVersion? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com This email sent to sevenbitst...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Trouble with services
My app has a service that gets invoked from the Finder. It works great, but I now have multiple versions of the app, and I can’t figure out how to change which one will open when the service is invoked. For example, I have one copy of my app in /Applications (the release one that’s on the app store), I have another one in an .xcarchive, and a third is the one I am currently developing. I want to be able to switch to the one in development, but every time I invoke it from the Finder, it opens the one in the .xcarchive. I thought this might be something pbs could do, but if it can, it wasn’t obvious. Thanks! Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Anyone seen [NSCursor set] crash by calling abort()?
At the risk of suggesting the obvious, did you test with the zombie instrument to see of you have a memory management bug unrelated to cursors? -- Jon On Apr 11, 2013, at 6:15 PM, Sean McBride s...@rogue-research.com wrote: On Thu, 11 Apr 2013 14:52:48 -0700, Quincey Morris said: I have an executable which runs fine on 10.7.5, but when run in 10.8.3 crashes as below. This repros 100% on several machines. The cursor is created plainly: [NSCursor pointingHandCursor], it happens with [NSCursor crosshairCursor] too, but not with IBeamCursor nor arrowCursor! Is this by chance a garbage-collected app? Yes; but I just tried again with old school manual-retain-release, and it repros the same. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/jon%40ambrosiasw.com This email sent to j...@ambrosiasw.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
Post a crash log? Did you run with zombies on? -- Jon On Feb 23, 2013, at 6:14 PM, Peter Hudson peter.hud...@me.com wrote: Hi All I use an NSSavePanel to save data to file in HTML format. This panel is run from a button in one of the panels in the app. The whole mechanism has been working absolutely fine for a long time - up until 10.8. I know find that if I click in the select directory popup that the app simply crashes. The other view arrangement functions on either side of the popup work fine. Any suggestions appreciated. 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: https://lists.apple.com/mailman/options/cocoa-dev/jon%40ambrosiasw.com This email sent to j...@ambrosiasw.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel problem
Just because a crash happens in an apple framework doesn't mean it's note our bug. If you can't take the time to run the code with zombies on, it's a waste of everyone else's time guessing what's going on. -- Jon On Feb 23, 2013, at 9:57 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Feb 23, 2013, at 18:12 , Andy Lee ag...@mac.com wrote: Also, to repeat part of Graham's question: is the window you're attaching the sheet to a floating window or a regular window? Maybe the sandboxing is irrelevant. How do you run it as a panel standalone - as opposed to as a sheet ? I don't remember the method name offhand, but you'll find it if you look at the docs for NSSavePanel. If you try it and the crash goes away, please let us know -- I'm curious. Peter didn't run it as a sheet. You can see in line 30 of the backtrace that his app invoked -[NSSavePanel runModal]. Also, according to the backtrace, the crash occurred in Cocoa frameworks (well, Apple frameworks, since it's in C++ code), so I wouldn't hare off looking for app memory management errors without any evidence supporting the idea. Rather, I think Graham's closer to being on the correct track. I've noticed that 10.8 NSSavePanel does have a tendency to explode, for reasons that are unclear. When it does that, it continues to explode until you find a way of getting it past the triggering condition. After that, it behaves properly until the next time. My guess is that 10.8 re-architected NSSavePanel (to better support sandboxing, but affecting non-sandboxing too) in such a way that there is persistent state stored outside the application. For that reason, quitting the app doesn't necessarily clear the problem. My guess is that in Peter's case the popup contains an entry that is no longer valid. It's possible that clicking the Save button without popping up the menu will clear it, or perhaps using the Save panel of a different application, or rebooting. Or possibly there's a preferences file that could be deleted. That's all speculation, but given the backtrace there's really no evidence the crash is Peter's fault. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/jon%40ambrosiasw.com This email sent to j...@ambrosiasw.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CW8021XProfile is deprecated; what to use instead?
I'm modifying a Mac app based in part on Apple's CoreWLANWirelessManager sample code. I'm trying to build it under 10.8 and I find that everything related to CW8021XProfile has been deprecated! The docs don't give a hint of what's replaced it. What's the new paradigm? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UIResponder differences from iOS4-iOS5
I found a curious difference in behavior running my app on an iOS4 device vs. running the same app on an iOS5 device. On iOS4, if I set a view (or really just a UIResponder) to be firstResponder, and then later, resignFirstResponder, there is no defined firstResponder; whatever was firstResponder previously is clobbered. Our app needed a more defined approach to this, so when a new firstResponder was being set, we attempt to iterate through all views to find and cache any existing firstResponder so we could restore it when our new firstResponder resigned its firstResponder status. I have found that on iOS 5, this seems to happen automatically: becomeFirstResponder seems to cache any existing firstResponder and resignFirstResponder restores the cached responder's firstResponder status. I can't find any Apple documentation that addresses this behavior at all. Is this behavior that can be relied upon? My reading of the UIResponder documentation is that I shouldn't rely on the state of the current firstResponder, and that if my app needs a specific view to be firstResponder at a particular point in time, it should set it explicitly. On the other hand, trying to determine the current firstResponder is clunky with current API's, and if Apple's doing it for me, I'd rather let them do it. I realize iOS 4 is ancient history at this point, though my app still needs to support it. (I also have no idea what the behavior is on iOS 6.) Below is some sample code that illustrates the different behavior: @interface testResponder : UIResponder @end @implementation testResponder - (UIResponder*)nextResponder { return [UIApplication sharedApplication].keyWindow.rootViewController; } - (BOOL)canBecomeFirstResponder { return YES; } @end @implementation ViewController -(BOOL) canBecomeFirstResponder { return YES; } -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self becomeFirstResponder]; NSLog(@View controller is now %@, ([self isFirstResponder] ? @FirstResponder : @NOT First Responder!)); testResponder *newResponder = [[testResponder alloc] init]; [newResponder becomeFirstResponder]; NSLog(@View controller is now %@, ([self isFirstResponder] ? @FirstResponder : @NOT First Responder!)); [newResponder resignFirstResponder]; NSLog(@View controller is now %@\n\n\n, ([self isFirstResponder] ? @FirstResponder : @NOT First Responder!)); [newResponder release]; } @end Output on iOS4: 2013-01-07 12:45:44.999 testFirstResponderTwo[835:607] View controller is now FirstResponder 2013-01-07 12:45:45.007 testFirstResponderTwo[835:607] View controller is now NOT First Responder! 2013-01-07 12:45:45.010 testFirstResponderTwo[835:607] View controller is now NOT First Responder! Output on iOS5: 2013-01-07 12:42:57.858 testFirstResponderTwo[1886:707] View controller is now FirstResponder 2013-01-07 12:42:57.862 testFirstResponderTwo[1886:707] View controller is now NOT First Responder! 2013-01-07 12:42:57.865 testFirstResponderTwo[1886:707] View controller is now FirstResponder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSWorkspace recycleURLs:completionHandler error -5000 (afpAccessDenied)
Containers/MyBundleId/Data/Library/Application Support/MyApp/MyFolderWhereRecycleFails -- Jon Gary / Object Orienteer / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.com/ On Dec 14, 2012, at 6:51 PM, Mike Abdullah wrote: On 14 Dec 2012, at 21:26, Jon Gary wrote: I have a sandboxed app that creates a file in a folder within the app's sandbox container. When the app is done with the file, it is moved to the trash using recycleURLs:completionHandler. A few of our users are reporting the you do not have permision to move the file to the trash. I've checked the permissions on the file itself and the user has read and write accces. We've had them run a shell command to make sure they have write access to their trash directory. None of this helps. I'm stumped. I've asked the user if they are using a networked home directory, but they say no (I'm not sure they understood the question). Any clues? When you say inside the app's sandbox container, where specifically are we talking? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSWorkspace recycleURLs:completionHandler error -5000 (afpAccessDenied)
I have a sandboxed app that creates a file in a folder within the app's sandbox container. When the app is done with the file, it is moved to the trash using recycleURLs:completionHandler. A few of our users are reporting the you do not have permision to move the file to the trash. I've checked the permissions on the file itself and the user has read and write accces. We've had them run a shell command to make sure they have write access to their trash directory. None of this helps. I'm stumped. I've asked the user if they are using a networked home directory, but they say no (I'm not sure they understood the question). Any clues? -- Jon Gary / Object Orienteer / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UIFont system font on Retina displays
On Retina display devices, such as the 3rd generation iPad, I found that the system font returned by [UIFont systemFontOfSize:] is a font whose family name is not included in the array of font families returned by [UIFont familyNames]. The family name that is returned is .HelveticaNeueUI Non-retina display devices return Helvetica as the system font, which is in the familyNames array. My question is: Why is the system font now excluded from the array of familyNames? Does the dot in front denote some kind of private status? The documentation for [UIFont familyNames] says it Returns an array of font family names available on the system, but clearly there are more font families on the system. If I go on to use the family name of the system font to create a new font, (eg. [UIFont fontWithName:size:]) will this be flagged as using private APIs? UIFont documentation doesn't say anything one way or the other. (Until yesterday, our app assumed it would find the system font family in the familyNames array, and wasn't prepared to deal with failure, so it crashes on launch on iPad 3s. Yikes!) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa-dev Digest, Vol 9, Issue 185
G On 16 mar ibi, at 14:57, cocoa-dev-requ...@lists.apple.com wrote: Send Cocoa-dev mailing list submissions to cocoa-dev@lists.apple.com To subscribe or unsubscribe via the World Wide Web, visit Speer ubInbhttpsuu://lists.al/viburnum-dev or, via email, send a message with subject or body 'help' to cocoa-dev-requ...@lists.apple.com You can reach the person managing the list at cocoa-dev-ow...@lists.apple.com When replying, please edit your Subject line so it is more specific than Re: Contents of Cocoa-dev digest... Today's Topics: 1. Re: Xcode 4.3.1 Universal Apps (Roland King) 2. iTunes like Fast Forward and Rewind Buttons (Peter Zegelin) 3. NSRuleEditor with variable-height rows? (Demitri Muna) 4. The use of UIActionSheet mysteriously disables our app with a whitescreen after memory warning. (G S) 5. Re: Xcode 4.3.1 Universal Apps (Eric Dolecki) 6. Re: Xcode 4.3.1 Universal Apps (Roland King) 7. How to become root (Gerriet M. Denkmann) 8. Re: How to become root (Jean-Daniel Dupas) 9. Re: How to become root (Gerriet M. Denkmann) 10. Re: How to become root (Jean-Daniel Dupas) 11. Re: iTunes like Fast Forward and Rewind Buttons (Alex Zavatone) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins (at) lists.apple.com https://lists.apple.com/mailman/listinfo/cocoa-dev ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS: Adding pinch-zoom to UIImageView
Here's what I've tried: IBOutlet UIScrollView *scrollView; // created placed on GUI with IB @synthesize scrollView; // hooked up from w/in IB - (void)viewDidLoad { [super viewDidLoad]; imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@default.png]]; [scrollView addSubview:imageView]; return; } The UIScrollView UIImageView show up on the GUI, with the correct image, but gestures are ignored. What am I overlooking? From: Fritz Anderson fri...@manoverboard.org To: Jon Sigman rf_...@yahoo.com Cc: Cocoa- Dev List cocoa-dev@lists.apple.com Sent: Tuesday, January 17, 2012 8:11 AM Subject: Re: iOS: Adding pinch-zoom to UIImageView On 16 Jan 2012, at 3:57 PM, Jon Sigman wrote: What's the typical way to add pinch capability to a UIImageView? Put it in a UIScrollView. — F ___ 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: iOS: Adding pinch-zoom to UIImageView
I just added this: [scrollView setContentSize:CGSizeMake(128.0,96.0)]; Now I can move the image about within the UIScrollView, but I can't pinch/zoom it. From: Eric E. Dolecki edole...@gmail.com To: Jon Sigman rf_...@yahoo.com Cc: Fritz Anderson fri...@manoverboard.org; Cocoa- Dev List cocoa-dev@lists.apple.com Sent: Tuesday, January 17, 2012 11:18 AM Subject: Re: iOS: Adding pinch-zoom to UIImageView Did you set the contentSize for the scroll view? Google Voice: (508) 656-0622 Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki http://blog.ericd.net On Tue, Jan 17, 2012 at 2:11 PM, Jon Sigman rf_...@yahoo.com wrote: Here's what I've tried: IBOutlet UIScrollView *scrollView; // created placed on GUI with IB @synthesize scrollView; // hooked up from w/in IB - (void)viewDidLoad { [super viewDidLoad]; imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@default.png]]; [scrollView addSubview:imageView]; return; } The UIScrollView UIImageView show up on the GUI, with the correct image, but gestures are ignored. What am I overlooking? From: Fritz Anderson fri...@manoverboard.org To: Jon Sigman rf_...@yahoo.com Cc: Cocoa- Dev List cocoa-dev@lists.apple.com Sent: Tuesday, January 17, 2012 8:11 AM Subject: Re: iOS: Adding pinch-zoom to UIImageView On 16 Jan 2012, at 3:57 PM, Jon Sigman wrote: What's the typical way to add pinch capability to a UIImageView? Put it in a UIScrollView. — F ___ 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 ___ 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: iOS: Adding pinch-zoom to UIImageView
Yep, specifying a delegate and implementing -viewForZoomingInScrollView: did the trick! (As a newb, I thought this functionality was innate in UIImageView, but...) Thanks to everyone for your help! From: Julius Oklamcak juli...@icodemonks.com To: 'Jon Sigman' rf_...@yahoo.com Cc: 'Cocoa- Dev List' cocoa-dev@lists.apple.com Sent: Tuesday, January 17, 2012 11:37 AM Subject: RE: iOS: Adding pinch-zoom to UIImageView You need to implement the -viewForZoomingInScrollView: UIScrollViewDelegate method and return the image view. Please have a look at Apple's ScrollViewSuite sample code: http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/Introduct ion/Intro.html I just added this: [scrollView setContentSize:CGSizeMake(128.0,96.0)]; Now I can move the image about within the UIScrollView, but I can't pinch/zoom it. ___ 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
iOS: Adding pinch-zoom to UIImageView
I have an iOS iPad app that uses a full screen UIImageView to display some png images. However, this arrangement doesn't allow the user to pinch-zoom the image. It seems to ignore gestures. I've tried embedding the UIImageView within a UIScrollView from IB (using Embed Object in Scroll View), and checking 'Multiple Touch' and 'User Interaction Enabled' for both views, but now I just get a white screen. What's the typical way to add pinch capability to a UIImageView? ___ 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: -viewDidUnload not always called?
On Oct 13, 2011, at 8:02 AM, Fritz Anderson wrote: My understanding is this, a diagram I made to visualize the process, http://drowland.net/iOS%20Class/View%20Controller%20unloading.pdf Wow, that's awesome. I never understood viewController unloading before. I wish the Apple documentation had such diagrams for all sorts of things: process startup, notification delivery, runloop processing, etc. I would think this would be the optimal way to communicate to programmers how things work! ___ 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: -viewDidUnload not always called?
On Friday, October 14, 2011 9:33 AM, David Rowland wrote: Well, thank you. If you are interested, here is the companion diagram for view controller loading, http://drowland.net/iOS%20Class/View%20Controller%20loading.pdf Great! These are keepers! (Some of us do think in pictures). You should be working for Apple's documentation team! ;-) On Oct 14, 2011, at 8:59 AM, Jon Sigman wrote: On Oct 13, 2011, at 8:02 AM, Fritz Anderson wrote: My understanding is this, a diagram I made to visualize the process, http://drowland.net/iOS%20Class/View%20Controller%20unloading.pdf Wow, that's awesome. I never understood viewController unloading before. I wish the Apple documentation had such diagrams for all sorts of things: process startup, notification delivery, runloop processing, etc. I would think this would be the optimal way to communicate to programmers how things work! ___ 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
Task dispatching
I have a Cocoa/Foundation application running in the background that receives a 1MB block of data, processes it, and sends back a new 1MB block of data using TCP/IP over the internet. The program takes a couple of minutes to come up and initialize, so it needs to be up and stay up waiting for processing requests. Now my boss wants to extend this to having multiple copies of the program running so that it can handle a dozen or so simultaneous users. Design-wise, should I have a lightweight front-end process that accepts all inbound requests and then dispatch the requests to one of the other idling processes? Or is there some standard Cocoa way to handle a farm of processes? GCD? I've looked at Xgrid but that seems batch/file/local oriented. OSX 10.6.8 ___ 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: Task dispatching
The first thing I'd look at, is what is going on for a couple of minutes while the program is coming up? Would that have to happen for every process??? Startup involves loading a 1GB data matrix from disk into memory. Transformations are then done using this matrix on the 1MB data blocks that are sent in via TCP/IP. That's why I can't simply start new tasks on-demand, the startup time is prohibitive so that complicates things. The first option (multiple processes) seems more robust but also harder to implement. Are there any design guidelines for implementing a server in Cocoa? From: Scott Ribe scott_r...@elevated-dev.com To: Jon Sigman rf_...@yahoo.com Cc: Cocoa- Dev List cocoa-dev@lists.apple.com Sent: Tuesday, September 13, 2011 9:55 AM Subject: Re: Task dispatching On Sep 13, 2011, at 10:42 AM, Jon Sigman wrote: Design-wise, should I have a lightweight front-end process that accepts all inbound requests and then dispatch the requests to one of the other idling processes? That is an extremely common idiom for servers. Whether you should do that, or multiple worker threads, really depends on your specific app. - Multiple processes incur some more overhead in communicating data back and forth, but a crash in any single server process only affects a single client. - Multiple threads allow the data to be handed off with no overhead, but a crash anywhere affects all clients. And of course there are many many other considerations ;-) The first thing I'd look at, is what is going on for a couple of minutes while the program is coming up? Would that have to happen for every process??? -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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: Task dispatching
On Sep 13, 2011, at 10:30 AM, Scott Ribe wrote: - Is that 1GB matrix static unchanging, read-only? If so, you might be able to use shared memory between the processes to avoid loading it more than once. The shared memory approach might work (I assume you mean with shm_open(), mmap(), shmget(), shmat(), etc.?) But isn't there a problem with the shm mechanism on multiprocessor hardware, or was that from years past? Also, won't I need to increase shmmax in the kernel, especially if I have numerous flavors of the 1GB matrix to load? From: Scott Ribe scott_r...@elevated-dev.com To: Jon Sigman rf_...@yahoo.com Cc: Cocoa- Dev List cocoa-dev@lists.apple.com Sent: Tuesday, September 13, 2011 10:30 AM Subject: Re: Task dispatching On Sep 13, 2011, at 11:11 AM, Jon Sigman wrote: Startup involves loading a 1GB data matrix from disk into memory. Transformations are then done using this matrix on the 1MB data blocks that are sent in via TCP/IP. That's why I can't simply start new tasks on-demand, the startup time is prohibitive so that complicates things. The first option (multiple processes) seems more robust but also harder to implement. Are there any design guidelines for implementing a server in Cocoa? - Is that 1GB matrix static unchanging, read-only? If so, you might be able to use shared memory between the processes to avoid loading it more than once. - A couple of minutes still seems like a long time to load it. Perhaps there is a more efficient way to store load it? You can probably find some basic sample code for a Cocoa server online, but much of what you need to do here is going to be at a lower level. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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: Task dispatching
I quickly wrote up a little program to test out mmap()'ing one of the 1GB files. It works, no kernel changes needed, and it only takes 0.871 secs! (51.209 secs if Time Machine is running ;) So, I'm stunned that this would be so much faster than using individual fread() calls for each element. (The 0.871 timing doesn't include the individual matrix element assignments into the memory map and other initialization processing, but that should only take a second or two.) If this really is doing what I think its doing, I will definitely go this way and just fire off a new process for each request. Thanks to all who replied, lots of great ideas! ___ 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: Task dispatching
You're right -- I ran a new test with a different 1GB matrix file, and the first time that it is mmap'd it takes approx 30 seconds; afterwards 1 second to map to (and loop through) what I suppose is an already cached image. I did verify that the data is there (it's a read-only dense matrix). Still, this should work out, since after the initial mmap load, it's quite speedy. From: Scott Ribe scott_r...@elevated-dev.com To: Steve Sisak sgs-li...@codewell.com Cc: Jon Sigman rf_...@yahoo.com; list-cocoa-dev cocoa-dev@lists.apple.com Sent: Tuesday, September 13, 2011 2:55 PM Subject: Re: Task dispatching On Sep 13, 2011, at 3:28 PM, Steve Sisak wrote: Actually, I believe that mmap just maps the the file into memory using the VM system -- it's initially paged out and read in as each page is touched... Yes, thus my comment. Did the OP actually read all values? The time seems too fast for that unless everything was cached. But on the other hand the time seemed way too slow to just be the mmap call itself without actually reading data. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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
Size of a file on disk
How does one determine the size of a file on disk using Cocoa? I've looked at NSFileManager but it doesn't seem to offer any methods for finding file attributes. OSX 10.6.8 ___ 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: Size of a file on disk
Many thanks to all who responded. Somehow I didn't notice the attributes methods of NSFileManager. I've got it working! -Jon ___ 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
Referencing an object after sending a release message to it
Folks, I'm trying to make sure that I correctly understand the rules for manual memory management in Cocoa. In particular, I'm curious as to the safety of sending an object a release message and then using that object later on in the same method. Here's the method that I'm curious about: - (IBAction)createEmployee:(id)sender { // Create the new Person object Person *p = [employeeController newObject]; // Add it to the content array of 'employeeController' [employeeController addObject:p]; [p release]; // Re-sort in case the user has sorted a column [employeeController rearrangeObjects]; // Get the sorted array NSArray *a = [employeeController arrangedObjects]; // Find the object just added NSUInteger row = [a indexOfObjectIdenticalTo:p]; NSLog(@starting edit of %@ in row %ld, p, row); } Is it dangerous to send the release message to p right after adding it to the array? Should I put the release at the end of the method? --jon ___ 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
Changing UISwitch text
Is there a straightforward way to change the text on the UISwitch (ON and OFF) to something else? Alternatively, is there a way for a UIButton to act like a toggle (it stays highlighted until touched again)? iOS 4.3 ___ 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: Changing UISwitch text
Thanks Peter, Dave, Roger. These are all good approaches! From: Roger Dalal roger.da...@gmail.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, April 29, 2011 4:41:36 PM Subject: Re: Changing UISwitch text Jon: UISwitch can not be customized. This question was asked a few weeks ago, and I recommended http://osiris.laya.com/projects/rcswitch/ by Sascha Hoehne and Robert Chin. If you wish to use a UIButton as a toggle, just change the button's image property to alternating states, as in: if(condition) { [self.buttonsetImage:offButtonImage forState:UIControlStateNormal]; condition == NO; } else { [self.button setImage:onButtonImage forState:UIControlStateNormal]; condition == YES; } GoodLuck. Roger Dalal Assembled Apps On Apr 29, 2011, at 7:29 PM, Jon Sigman wrote: Is there a straightforward way to change the text on the UISwitch (ON and OFF) to something else? Alternatively, is there a way for a UIButton to act like a toggle (it stays highlighted until touched again)? iOS 4.3 ___ 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/roger.dalal%40gmail.com This email sent to roger.da...@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
warning: cast from pointer to integer of different size
Basic question: Just for debugging purposes, I'm trying to print out the address of a pointer to a struct, but I can't figure out the proper way to do it (ie, satisfy the compiler warnings). OSX 10.6.7, Xcode 3.2.6 dispatch_source_t our_gcd_source; . . . printf(gcd_source: %08X\n,gcd_source); warning: format '%08X' expects type 'unsigned int', but argument 2 has type 'dispatch_source_t' . . . printf(gcd_source: %08X\n,(unsigned int)gcd_source); warning: cast from pointer to integer of different size Thx ___ 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: warning: cast from pointer to integer of different size
Thanks, David. I do recall that now. Need more coffee... From: David Duncan david.dun...@apple.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Tue, April 19, 2011 11:01:40 AM Subject: Re: warning: cast from pointer to integer of different size %p On Apr 19, 2011, at 10:50 AM, Jon Sigman wrote: Basic question: Just for debugging purposes, I'm trying to print out the address of a pointer to a struct, but I can't figure out the proper way to do it (ie, satisfy the compiler warnings). OSX 10.6.7, Xcode 3.2.6 dispatch_source_t our_gcd_source; . . . printf(gcd_source: %08X\n,gcd_source); warning: format '%08X' expects type 'unsigned int', but argument 2 has type 'dispatch_source_t' . . . printf(gcd_source: %08X\n,(unsigned int)gcd_source); warning: cast from pointer to integer of different size Thx ___ 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/david.duncan%40apple.com This email sent to david.dun...@apple.com -- David Duncan ___ 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
Injecting text into a CALayer?
In iOS 4.3, I have an app that uses CALayers to draw small circles on the screen like so: CALayer *_layer = [[CALayer alloc] init]; [_layer setDelegate:self]; [_layer setBounds:CGRectMake( 0,0,100,100 )]; [_layer setNeedsDisplay]; Is there a way I can draw text into the circle regions? I'd like to label them. -Jon ___ 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: Injecting text into a CALayer?
self' is my circle object. I forgot to mention that I move the circles around onscreen, so the text would ideally somehow be embedded within the circle objects so they could track together. Would it make sense to have a parallel CATextLayer associated with each CALayer in my circle object? Or does CAShapeLayer have that capability? From: David Duncan david.dun...@apple.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, April 15, 2011 11:42:49 AM Subject: Re: Injecting text into a CALayer? On Apr 15, 2011, at 11:11 AM, Jon Sigman wrote: In iOS 4.3, I have an app that uses CALayers to draw small circles on the screen like so: CALayer *_layer = [[CALayer alloc] init]; [_layer setDelegate:self]; [_layer setBounds:CGRectMake( 0,0,100,100 )]; [_layer setNeedsDisplay]; Is there a way I can draw text into the circle regions? I'd like to label them. What is 'self' in the code above? Having the delegate draw the text would be the simplest thing you can do. Next simplest would be to add a CATextLayer sublayer. At a higher level however, you could do the exact same thing with UIViews and use UILabel for your labels (which since they do less work for text layout are generally faster). -- David Duncan ___ 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: Injecting text into a CALayer?
Yes, that works splendidly! Thanks, David! From: David Duncan david.dun...@apple.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, April 15, 2011 11:54:36 AM Subject: Re: Injecting text into a CALayer? Using a sublayer for this purpose is I think the best solution for your issue. Just create a CATextLayer and add it as a sublayer and your set. On Apr 15, 2011, at 11:52 AM, Jon Sigman wrote: self' is my circle object. I forgot to mention that I move the circles around onscreen, so the text would ideally somehow be embedded within the circle objects so they could track together. Would it make sense to have a parallel CATextLayer associated with each CALayer in my circle object? Or does CAShapeLayer have that capability? From: David Duncan david.dun...@apple.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, April 15, 2011 11:42:49 AM Subject: Re: Injecting text into a CALayer? On Apr 15, 2011, at 11:11 AM, Jon Sigman wrote: In iOS 4.3, I have an app that uses CALayers to draw small circles on the screen like so: CALayer *_layer = [[CALayer alloc] init]; [_layer setDelegate:self]; [_layer setBounds:CGRectMake( 0,0,100,100 )]; [_layer setNeedsDisplay]; Is there a way I can draw text into the circle regions? I'd like to label them. What is 'self' in the code above? Having the delegate draw the text would be the simplest thing you can do. Next simplest would be to add a CATextLayer sublayer. At a higher level however, you could do the exact same thing with UIViews and use UILabel for your labels (which since they do less work for text layout are generally faster). -- David Duncan -- David Duncan ___ 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
UISegmentedControl -selectSegmentAtIndex:?
iOS 4.3. I'm using a UISegmentedControl and want to preselect one of the segments in -viewDidLoad based on the last user setting stored in defaults. But, I can't find a -selectSegmentAtIndex: method or a reasonable facsimile. How can I go about doing this? ___ 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: UISegmentedControl -selectSegmentAtIndex:?
Thanks, Luke. Somehow I was thinking that was a read-only property (selected = past tense). My bad. From: Luke the Hiesterman luket...@apple.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Mon, March 21, 2011 6:53:58 PM Subject: Re: UISegmentedControl -selectSegmentAtIndex:? @property(nonatomic) NSInteger selectedSegmentIndex; so, segmentedControl.selectedSegmentIndex = theIndexYouWant; Luke On Mar 21, 2011, at 6:49 PM, Jon Sigman wrote: iOS 4.3. I'm using a UISegmentedControl and want to preselect one of the segments in -viewDidLoad based on the last user setting stored in defaults. But, I can't find a -selectSegmentAtIndex: method or a reasonable facsimile. How can I go about doing this? ___ 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/luketheh%40apple.com This email sent to luket...@apple.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: Setting a delegate on a UITextField
On Sat, 05 Mar 2011 11:22:46 -0800 Matt Neuburg wrote: One possible approach on iOS is to implement textFieldShouldEndEditing, and return NO and put up an alert if there's a problem. Another is just to make the change yourself in textFieldDidEndEditing. See the section entitled Validating Entered Text (along with the preceding section) in the Managing Text Fields and Text Views chapter of the Text, Web, and Editing Programming Guide for iOS. That looks like a good fit. But is there some trick in getting textFieldShouldEndEditing invoked? I have also a textFieldDidBeginEditing and a textFieldDidEndEditing method; they get invoked when the user touches the Return key on the keypad, but textFieldShouldEndEditing does not. ___ 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: Setting a delegate on a UITextField
On Mon, March 7, 2011 9:30:05 AM Matt Neuburg wrote: The Return key invokes textFieldShouldReturn: and does *not* automatically resign first responder ... Ah! That is the part I had been overlooking. textFieldShouldReturn is the perfect place to validate the input. However, now that I've implemented it, textFieldShouldReturn gets called twice immediately when the Return key gets pressed on the keypad, not sure why... 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: Setting a delegate on a UITextField
Matt, you are quite correct. It helps to simplify the case, and then build on that foundation. I had too many things going on and couldn't see the forest for the trees. Thanks! From: Matt Neuburg m...@tidbits.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Mon, March 7, 2011 11:04:25 AM Subject: Re: Setting a delegate on a UITextField On Mar 7, 2011, at 9:54 AM, Jon Sigman wrote: On Mon, March 7, 2011 9:30:05 AM Matt Neuburg wrote: The Return key invokes textFieldShouldReturn: and does *not* automatically resign first responder ... Ah! That is the part I had been overlooking. textFieldShouldReturn is the perfect place to validate the input. However, now that I've implemented it, textFieldShouldReturn gets called twice immediately when the Return key gets pressed on the keypad, not sure why... Thanks! Once again I repeat my advice - start with a totally clean project with nothing but a text field and its delegate and watch the delegate messages. Keep it *simple* when exploring the framework. You will see that what you're saying is false. The sequence will be: - (BOOL)textFieldShouldReturn:(UITextField *)textField { NSLog(@%@, NSStringFromSelector(_cmd)); [textField resignFirstResponder]; return YES; } - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { NSLog(@%@, NSStringFromSelector(_cmd)); return YES; } - (void)textFieldDidEndEditing:(UITextField *)textField { NSLog(@%@, NSStringFromSelector(_cmd)); } 2011-03-07 11:02:00.934 Crud[7945:207] textFieldShouldReturn: 2011-03-07 11:02:00.936 Crud[7945:207] textFieldShouldEndEditing: 2011-03-07 11:02:00.938 Crud[7945:207] textFieldDidEndEditing: Now add your validation. I really can't advise using textFieldShouldReturn: for validation, because there are many *other* ways in which a text field might resign first responder, and then you'd miss out on your validation test. It is best to adopt habits that work in general, with the intent of the framework, rather than just going with something that happens to seem to work okay in one limited case. m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.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
Setting a delegate on a UITextField
I'm trying to set up a delegate on a UITextField so I can know when the user has finished editing. My delegate is my main view controller: @interface MainViewController : UIViewController UITextFieldDelegate { . . . } and in the implementation file I have: - (void) textFieldDidEndEditing:(UITextField)textField { // do stuff } I set the delegate on the textfield like this: nameTextField.delegate = (id UITextFieldDelegate)mainViewController; It all builds but at runtime my delegate method never gets called. What am I overlooking? iOS 4.2 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting a delegate on a UITextField
On Thu, March 3, 2011 2:19:30 PM Phillip Mills phillip.mil...@acm.org wrote: First question: Is your 'nameTextField' truly non-nil when you set its delegate? Good call. It was being set before the -viewDidLoad method got invoked. It all works now! Second question: What do you define as finished editing? When the user touches the Return button on the keypad. Is that a poor assumption? Thanks! -Jon ___ 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: Setting a delegate on a UITextField
Okay, part II: Is there a way to allow only a certain number of characters in a UITextField? Should this be done in the -textFieldDidEndEditing delegate callback, with an alert to the user, or just truncating the field, or ...? -Jon ___ 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
Canceling all touches
I'm looking for a 'legal' way to cancel all the currently in-progress touches, exactly like they are cancelled when a UIAlertView is shown. After hours of searching (documentation, googling), I've come up empty. I see that the undocumented _cancelAllTouches in UIApplication is exactly what I want, and it works just like I want it too. Is there a good reason why this method isn't public? Is there any alternate, 'legal' way of canceling an in-progress touch? I can't seem to find any. (My code needs to receive the actual cancel message - not just ignore the touchMoved events.) Thanks in advance for any advice. Regards, Jon Brooks ___ 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
iOS: Calling up numeric keypad
I have a UITextField that should accept only numerics. Is there a way to set the textfield so that when the user touches it, the numeric keypad comes up instead of the alpha keypad? iOS 4.2.1 ___ 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: iOS: Calling up numeric keypad
That's awesome. I never knew you could do that. Works great! Thanks Conrad and Laurent! From: Conrad Shultz con...@synthetiqsolutions.com To: Laurent Daudelin laur...@nemesys-soft.com Cc: Jon Sigman rf_...@yahoo.com; cocoa-dev@lists.apple.com Sent: Tue, February 22, 2011 1:06:40 PM Subject: Re: iOS: Calling up numeric keypad -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2/22/11 12:56 PM, Laurent Daudelin wrote: I'm surprised nobody replied to this yet. Open the interface file in Interface Builder. Set the keyboard for that UITextField to use the numeric keyboard. Then, each time the user touches the textfield, the numeric keyboard will show up. Beat me to it... I was waiting to get back to IB to verify what the setting was called. :-) Also, in the event that you need to do this in code, you can set the keyboardType property appropriately. This property (and others) are defined in the UITextInputTraits protocol, found in the header of the same name. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNZCVfaOlrz5+0JdURAoXBAJ9Fhl7fGpT8pIg14k8+SzZoVH5d5wCdEXrs zhTG6HsjNloUSq9ybExKlPg= =mSiR -END PGP SIGNATURE- ___ 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: Trouble with design pattern
Maybe I'm missing your point but the compiler warning is trivial to address. - [NSWindowController document] returns an id. If you want to call methods in your document class, CarlosDocument * doc = (CarlosDocument*) [windowController document]; [doc carlosMethod]; However if your views are calling methods on your document, you're doing it wrong. Your views should operate on data provided by your document (preferably via bindings) and by actions your views call into your document (or window controller, depending upon how you've designed your app). -- Jon Gary / Object Orienteer / Ambrosia Software, Inc. -- http://www.AmbrosiaSW.com On Feb 18, 2011, at 2:20 PM, Carlos Eduardo Mello wrote: 1) Is there a better way to approach this? ___ 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
awakeFromNib on main thread?
I did a search of the docs but didn't find this question addressed... During the object instantiation phase of app startup, is every -awakeFromNib method guaranteed to be called on the app's main thread? ___ 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: awakeFromNib on main thread?
On Feb 14, 2011, at 5:41 PM, Seth Willits wrote: On Feb 14, 2011, at 4:57 PM, Jon Sigman wrote: I did a search of the docs but didn't find this question addressed... During the object instantiation phase of app startup, is every -awakeFromNib method guaranteed to be called on the app's main thread? Given that AppKit is generally not thread-safe, one would hope you're only ever loading your nibs on the main thread anyway... Yeah, makes sense. 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: NSDictionary key types
The underlying issue I was having was how to know when different objects used as keys might be reasonably expected to match, especially if they weren't generated the same way (as with [NSNumber stringValue] and [NSString ...]). I guess the long answer is its complicated, and the short answer is just use NSStrings. Thanks to all, I think I'm getting the hang of it. Kirk Kerekes wrote: If you are insufficiently confused, I thought I would add some additional confusion. 1. Don't worry overmuch about hash values. Particularly, never succumb to the temptation to store them persistently. The -hash algorithm for a particular class may vary with OS version. It certainly has before. It certainly varies from class to class. 2. Do not expect items like NSString and NSNumber to return the same hash values for humanly-similar entities like [NSNumber numberWithNSInteger: 12345] and [NSString stringWithString: @12345]. 3. Do not expect collection hashes to take into account the entire contents of the collection. -isEqual does, however. 4. It is entirely feasible to use a non-string object as a dictionary key, so long as it obeys the general requirements for dictionary keys. You can use a NSNumber as a dictionary key, a NSDate as a dictionary key, a NSDictionary as a dictionary key, any immutable object that implements -hash and -copy, pretty much. Including your own. A problem with using collections as dictionary keys is that even though the collection may be immutable, there is no guarantee that the objects in the collection are. 5. Good practice would be to try to stick to using NSStrings as dictionary keys. This moves further towards compliance with property lists, and it is very nice to be able to read/write an arbitrary dictionary as a property list. Also makes debugging easier. 6. That dictionary keys are immutable leads to some nice efficiencies -- if you define a key as a NSString literal: #define MYKEY @My Key; (or) NSString * myKey = @My Key; -- then every time you use MYKEY or myKey in a dictionary (or anywhere), the dictionary key will be that specific global instance of that NSString -- a singleton. You can create 1000 NSDictionaries containing a key My Key, but there will be only exactly one in-memory instance of that key. This means that -isEqual on that key will always short-circuit to an address comparison, which is about as efficient as you can get. Speed and space optimization at a single stroke. Immutability is a lovely attribute. Of course, once you start saving and reloading NSDictionaries, you likely start losing this niftyness, unless Apple has implemented undocumented optimizations like coalescing new instances of NSStrings into a global string cache. They might have done that, Apple likes that sort of thing, and it wouldn't be hard to implement. It would be even more compelling on iOS, where storage, RAM and computing power are comparatively scarce. ___ 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
NSDictionary key types
I'm a bit new to Cocoa, and I'm trying to get my head around NSDictionary. In the Apple documentation it says, Each entry consists of one object that represents the key and a second object that is the key's value. ... In general, a key can be any object, but note that when using key-value coding the key must be a string. So, I supply an object that *represents* the key, meaning that this object itself is not the key, but it's value is? That makes sense for NSStrings, but not if the key is some other object without an obvious value, like an NSArray. Are the two key types somehow treated differently? ___ 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: NSDictionary key types
So are the following two equivalent? id myKey = [NSNumber numberWithInt:8760]; if (myObj = [myDict objectForKey:myKey]) { . . . do something } and id myKey = @8760; if (myObj = [myDict objectForKey:myKey]) { . . . do something } From: Nick Zitzmann n...@chronosnet.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Thu, January 6, 2011 12:40:00 PM Subject: Re: NSDictionary key types On Jan 6, 2011, at 1:10 PM, Jon Sigman wrote: I'm a bit new to Cocoa, and I'm trying to get my head around NSDictionary. In the Apple documentation it says, Each entry consists of one object that represents the key and a second object that is the key's value. ... In general, a key can be any object, but note that when using key-value coding the key must be a string. So, I supply an object that *represents* the key, meaning that this object itself is not the key, but it's value is? Correct, because the key object is copied rather than retained. That makes sense for NSStrings, but not if the key is some other object without an obvious value, like an NSArray. Are the two key types somehow treated differently? They're copied, too. But in general, keys tend to be either strings or numbers or URLs or something like that. It is very unusual to have a collection as a key. As an object, yes, but not as a key. Nick Zitzmann http://www.chronosnet.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: NSDictionary key types
On Jan 6, 2011, at 1:50 PM, Nick Zitzmann wrote: So are the following two equivalent? id myKey = [NSNumber numberWithInt:8760]; if (myObj = [myDict objectForKey:myKey]) { . . . do something } and id myKey = @8760; if (myObj = [myDict objectForKey:myKey]) { . . . do something } No, because a number is not a string. -- Is this what the documentation for isEqual: refers to when it says If two objects are equal, they must have the same hash value? How do I determine what an object's hash value is? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDictionary key types
From: Nick Zitzmann n...@chronosnet.com To: Jon Sigman rf_...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Thu, January 6, 2011 1:04:47 PM Subject: Re: NSDictionary key types On Jan 6, 2011, at 1:04 PM, Nick Zitzmann wrote: On Jan 6, 2011, at 2:03 PM, Jon Sigman wrote: Is this what the documentation for isEqual: refers to when it says If two objects are equal, they must have the same hash value? How do I determine what an object's hash value is? It's the value returned from the hash property declared by NSObject. Okay, I'm thoroughly confused now. What exactly is this hash value? The documentation just says its an integer that can be used as a table address in a hash table structure. That doesn't mean much to me. Do the following two objects have the same hash value, and if so, why do thay? How is it assigned? id myStr1 = @8760; id myStr2 = @8760; ___ 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: NSDictionary key types
On Jan 6, 2011, at 1:24 PM, David Duncan wrote: The short of it is that its a value that allows you to quickly tell if something is worth looking at more closely for equality. As a real world example a hash code is equivalent to saying this object is short, this object is tall without breaking out a ruler to determine if they are the same length. - Okay, so the take-away from all this is that for the purpose of using objects as keys, I can rely on two NSStrings hashes being equal if their string values are equal; the same goes for two NSNumbers, etc. (though NSNumber might be a more problematic case since it can be evaluated in numerous different ways, -int -float, ...?). If I've understood everything correctly, then the following two (contrived) objects have the same hash value and will return TRUE from -isEqual: id myStr1 = @8760; id myStr2 = [[NSNumber numberWithInt:8760]stringValue]; ___ 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
Question regarding popoverControllerDidDismissPopover: delegate method
My iPad application has a UIPopover that presents a table view. When a user clicks on an item in the table view, the contentController dismisses the popover. Also, the popover has the default behavior such that a click outside the popover will dismiss it as well. The parent viewController retains the popoverController when it is shown and releases it when it is dismissed. Because of this, I need to detect when a touch outside the popover has dismissed it, and release the popover controller. I do this using the delegate method popoverControllerDidDismissPopover:. All of this seems like it would be a pretty standard implementation of a UIPopover. The problem comes if a user simultaneously taps both an item in the popover, and outside the popover. In this case, I first get the delegate, popoverControllerDidDismissPopover: which is fielding the tap outside the popover, followed by my method responding to the touch inside the popover, which tries to dismiss an already dismissed popover. On the surface, all of this seems to be harmless, but triggers asserts I have in place to detect this. I am nervous about removing the asserts, because after popoverControllerDidDismissPopover: has been called, nothing in my code is retaining the popover controller, yet my method that responds to touches inside it is will rely on it still being around. Should I just assume that if it's still fielding touches, that it's still retained by a view, and everything will be fine? Is this a bug that the popover is still fielding a touch after the delegate method popoverControllerDidDismissPopover: is called? Thanks in advance for any advice. Jon Brooks ___ 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
Implementing async notifications
I have a Cocoa app that uses a dedicated thread to receive messages, and I would like that thread to post those messages as notifications so they can be processed asynchronously, outside my receiving loop (but not on the main thread). Looking at NSNotificationQueue, I'm totally confused by it. I searched for a code example of how it interfaces with NSNotificationCenter but couldn't find one complete enough to implement. So... since notifications are executed on the thread that enqueued the notification, would it be okay to do the following within my receiving loop: 1. Receive a message 2. Package the message into a NSData object 3. Use -performSelectorInBackground:withObject: to invoke a method that posts a notification to the default notification center. 4. The notification is processed asynchronously in the background thread, and exits. Would this approach work to achieve async notification processing? -Jon ___ 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
Keeping track of state in Cocoa
How does one track state in Cocoa? I have a message receiver which manages a number of TCP-connected processes (100 or so). However, I need to keep track of the state of each connected process (registered, busy, waiting, etc) to know what operations are 'legal' or appropriate for dealing with each one. Is there any construct, design pattern, object, etc inherent in Cocoa or OSX that is used for this kind of thing, or do people 'roll their own' with some sort of ad hoc table, struct, etc? ___ 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: Keeping track of state in Cocoa
So instead of having struct arrays, etc, I replace all that with a custom object, an instance of which represents each process, and manage them by associating them with different state collections as appropriate. Thanks, I think that's doable. ___ 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
Foundation vs Core Foundation
I'm new to OSX/Cocoa, coming from Solaris. I'm porting the functionality of a Solaris connection server to Mac OS X. Porting isn't exactly the right word since I'm taking the liberty to use Cocoa and whatever else OSX offers to get things working well, including rearchitecting. Before I start down the wrong path: What is the difference between a Foundation tool and a Core Foundation tool? Primarily I will be needing to use TCP/IP sockets, file I/O, and multithreading, so is one a better fit than the other? I believe OSX calls this type of GUI-less background process a 'daemon'. This would be for Snow Leopard. Thanks, -Jon ___ 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: Foundation vs Core Foundation
It sounds like Foundation is the safer way to go, especially to safeguard future functionality expansion. I take it Foundation does not contain Core Foundation, but at least they're not mutually exclusive? If I go Foundation, I can include Core Foundation as well, should I want something in it, since it's just C? ___ 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: $ to Jobs ?
On Nov 23, 2010, at 2:25 PM, k...@highrolls.net wrote: If the app is purchased will it expire as well on a user device? Of course not. The expiry date is only for development devices. It will work indefinitely on a user's device. ___ 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
NSView exitFullScreenModeWithOptions results in dimmed menus in document based app
When I call exitFullScreenModeWithOptions in a document based app, the menu items are permanently dimmed out. I've tried making everything I can think of firstResponder, but still dimmed out. I tried a couple of alternate full screen methods, to see if I could get around it, but I'm using a layer backed view and they didn't work or flickered too bad. Any pointers on where to look? Thanks, Jon. ___ 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
Garbage Collection, Standard Out, NSTask
Below is a simple test application that launches a process and logs the output as it runs. It works as expected when the app is set to no garbage collection, but as soon as I turn on garbage collection, the following notifications stop working: - NSTaskDidTerminateNotification - NSFileHandleReadCompletionNotification It's been stumping me for a few days. The sample app and source is at: http://sessionsplus.com/TaskTester.zip Thanks! Jon.___ 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: Garbage Collection, Standard Out, NSTask
That was it, though further up the chain. The object that created/owned the task was being GC'd away. Thanks Bill and Quincy! On Nov 16, 2010, at 12:53 PM, Bill Bumgarner wrote: The issue [I'd bet -- don't have time to dive deep] is that you don't have a strong reference to the Tasker instance. Since notification observers don't hold strong references to observers, either, the garbage collector sees Tasker as garbage and collects it. You could fix this any number of ways; - keep a reference to the Tasker instance as an iVar - keep a global set around of active taskers and have 'em remove themselves when they are done - use CFRetain or the NSGarbageCollector API to tell the collector not to collect the tasker before done. 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: [iPhone] Toolbar button and Touch Down
Yeah, UIToolbars are odd beasts. Try this out: place a UISwitch in a toolbar, hook it up to an IBAction, and you get... nothing. It switches from ON to OFF and back, but the action never fires. Bug? Feature? Not exactly 'standard and easy' imho. Maybe the 'next major release' will address this. From: Jonathon Kuo newsli...@autonomy.caltech.edu To: Matt Neuburg m...@tidbits.com Cc: cocoa-dev@lists.apple.com Sent: Tue, November 16, 2010 9:26:40 AM Subject: Re: [iPhone] Toolbar button and Touch Down On Nov 16, 2010, at 9:12 AM, Matt Neuburg wrote: On Mon, 15 Nov 2010 10:02:44 -0800, Jonathon Kuo newsli...@autonomy.caltech.edu said: Interesting idea, probably a little beyond me. :) Nonsense. This is perfectly standard and easy. A UIButton can send an action message on TouchDown. It makes no difference that the UIButton is inside a UIBarButton. How much plainer can it be? m. I agree: that's how I expected it to work, too, but that's not how it does work (Xcode 3.2.4). If I drag a Round Rect Button onto the Toolbar, it instantly gets promoted to a UIBarButtonItem (really!), and I can't set Touch Down on it, nor can I change the class of it in IB. That's why I'm confused... ___ 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/rf_egr%40yahoo.com This email sent to rf_...@yahoo.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] Toolbar button and Touch Down
I struggled this too, but without solution. It seems that toolbar 'buttons' aren't real buttons -- they're class UIBarButtonItem from UIBarItem from NSObject. Since they're not really buttons, there doesn't appear any way to modify their behavior. If there is a way, I'd like to know, too... From: Jonathon Kuo newsli...@autonomy.caltech.edu To: Cocoa-Dev List cocoa-dev@lists.apple.com Sent: Fri, November 12, 2010 10:02:15 AM Subject: [iPhone] Toolbar button and Touch Down I'm doing an iPhone 4.1 app and I have a toolbar at the bottom with bar buttons. The problem is that I need to set one of the bar buttons to Touch Down instead of the default Touch Up Inside but IB doesn't show any touch options for toolbar buttons (it does for buttons not in the toolbar). Is there a programmatic way to set this? Thx ___ 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/rf_egr%40yahoo.com This email sent to rf_...@yahoo.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
Embedding a system preference pane
Hi I'm trying to embed a couple of the system pref panes into an app by following the Apple documented method, here's basically whats going on: NSBundle *bundle = [NSBundle bundleWithPath:@/System/Library/PreferencePanes/SharingPref.prefPane]; Class principalClass = [bundle principalClass]; prefPane = [[principalClass alloc] initWithBundle:bundle]; [prefPane loadMainView]; [prefPane willSelect]; prefView = [prefPane mainView]; [[[self window] contentView] addSubview:prefView]; [[self window] makeKeyAndOrderFront:self]; [prefPane didSelect]; This works fine for one of the other panes. I then tried it for the Sharing pref pane but it only seems to be half working. The Pane appears and I can see the computer name and the table with the list of services but only the DVD Sharing service is working (somewhat). None of the other services are reflecting the state of that service and they are always greyed out. Also when you select a service it's corresponding settings view does not appear on the right side of the table (I hope this is making sense). This is not something hacky, it is documented by Apple and is supposed to work but it's clearly not or I'm doing something wrong. Any help would be appreciated. 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
NSResponder action messages not being received correctly
I have created a tiny project that consists of an NSWindowController subclass which opens its window during the app delegate's applicationDidFinishLaunching: method. There are no custom NSWindow or NSView subclasses. I'm trying to override various NSResponder action messages. Some work, some don't. My window controller has the methods below. I am on a Macbook Pro keyboard. I see the following behavior: If I press the LeftArrow, I see LEFT on the console. So far so good. If I press Fn-UpArrow (PgUp), I see PGUP on the console. Still ok. If I press Fn-Ctrl-UpArrow (Ctrl-PgUp), I see PGUP on the console. This is a problem. I expected to see S_PGUP get printed. I've tried this on 2 computers and don't believe there are any custom keybindings in effect. I also double checked this with the Keyboard Shortcuts control panel item. While I give the example for scrollPageUp:, others are affected too (e.g.scrollToBeginningOfDocument:) Does anyone have insight as to what might be going on? Thanks, nall. -(IBAction)moveLeft:(id)sender { NSLog(@LEFT); } -(IBAction)scrollPageUp:(id)sender { NSLog(@S_PGUP); } -(IBAction)pageUp:(id)sender { NSLog(@PGUP); } ___ 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
NSStream Questions
Folks, I'm a bit new to Cocoa/iPhone programming, so I apologize if this is Ye Olde Question Again. Googling hasn't quite anwered my quesion yet... I'm writing a network server that needs to accept many simultaneous client connections and keep track of them. I've written the base server parts, roughly in the style of the Apple Examples (SimpleNetworkStreamsExample). These examples, however, only allow one connected client. I need to manage several full duplex NSStream in/out pairs. I can arrange to have a Connected Clients table that contains both the inStream and outStreams created for the accepted fd (CFSocketNativeHandle) using some class that glues the inStream, outStream and clientNumber together in a table. My problem originates at the point when the stream event handling delegate is called: - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode At this point I have the active stream, aStream, in hand, but I don't know which client it belongs to. Ultimately, this means I can't reply to the client for lack of deriving its matching outStream or clientNumber in my table. Is there a (void *) data that I can associate with a NSStream at the time I create it and later retrieve it at stream:handleEvent: time? Or do I have to search my client table for a matching stream handle on every read/write event? What am I missing? Thanks, jdl ___ 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: Interface Builder input panel fields not updated when OK button clicked
At 3:02 PM +1000 4/9/10, Ben Golding wrote: I can't seem to find a way of ending editing on all the fields when the button is pressed? Is there a way to do this? NSWindow endEditingFor: Forces the field editor to give up its first responder status and prepares it for its next assignment. - (void)endEditingFor:(id)object Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I get a file reference w/o relying on the path?
At 9:54 AM +0200 4/6/10, Jean-Daniel Dupas wrote: Le 4 avr. 2010 à 19:50, Jens Alfke a écrit : You're saying that if I have a FSRef to a file, then the file is moved, the FSRef will still reference the moved file and not the location where it used to be? That's surprising to me, because FSRefs were created as a replacement for FSSpecs, which do not have that property (they were a struct {volume ID, dir ID, filename}.) Anyway, note that a file inode ID is more fragile than an alias/bookmark, because it won't survive the common practice of replacing an old copy of a file with a new one (safe save) unless the code doing the replace is careful to propagate metadata to the new file. FSExchangeObjects and exchangedata(2) do not exchange the file ID. The new file will have the same ID than the old one, and so, the FSRef will point on the new file automatically. Unfortunately, FSRefs don't survive the common practice of manually replacing the file in the Finder. This *does* change the file id and invalidates the FSRef. I had to change to explicitly saving an AliasRecord in an NSData to keep track of a file properly. Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How do I get a file reference w/o relying on the path?
At 8:43 AM -0700 4/6/10, Jon Pugh wrote: I had to change to explicitly saving an AliasRecord in an NSData to keep track of a file properly. I should probably clean up and share my code too. This uses an alias relative to your home folder. The alias is stored in NSUserDefaults under the specified key. You probably want to retain or copy the path you get from loadPathFromKey since it's autoreleased or nil. Enjoy. Jon - (void) savePath: (NSString*) path forKey: (NSString*) key { FSRef fsFile, fsHome; AliasHandle aliasHandle; NSString* homePath = [@~ stringByExpandingTildeInPath]; OSStatus status = FSPathMakeRef((unsigned char*)[homePath cStringUsingEncoding: NSUTF8StringEncoding], fsHome, NULL); NSAssert(status == 0, @FSPathMakeRef fsHome failed); status = FSPathMakeRef((unsigned char*)[path cStringUsingEncoding: NSUTF8StringEncoding], fsFile, NULL); NSAssert(status == 0, @FSPathMakeRef failed); OSErr err = FSNewAlias(fsHome, fsFile, aliasHandle); NSAssert(err == noErr, @FSNewAlias failed); NSData* aliasData = [NSData dataWithBytes: *aliasHandle length: GetAliasSize(aliasHandle)]; [[NSUserDefaults standardUserDefaults] setObject: aliasData forKey: key]; } - (NSString*) loadPathFromKey: (NSString*) key { NSData* aliasData = [[NSUserDefaults standardUserDefaults] dataForKey: key]; int aliasLen = [aliasData length]; if (aliasLen 0) { FSRef fsFile, fsHome; AliasHandle aliasHandle; OSErr err = PtrToHand([aliasData bytes], (Handle*)aliasHandle, aliasLen); NSAssert(err == noErr, @PtrToHand failed); NSString* homePath = [@~ stringByExpandingTildeInPath]; OSStatus status = FSPathMakeRef((unsigned char*)[homePath cStringUsingEncoding: NSUTF8StringEncoding], fsHome, NULL); NSAssert(status == 0, @FSPathMakeRef fsHome failed); Boolean changed; err = FSResolveAlias(fsHome, aliasHandle, fsFile, changed); if (err == noErr) { char pathC[2*1024]; status = FSRefMakePath(fsFile, (UInt8*) pathC, sizeof(pathC)); NSAssert(status == 0, @FSRefMakePath failed); return [NSString stringWithCString: pathC encoding: NSUTF8StringEncoding]; } } else { NSLog(@CardCollectionUserDefault was zero length); [NSAlert alertWithMessageText: nil defaultButton: nil alternateButton: nil otherButton: nil informativeTextWithFormat: @CardCollectionUserDefault was zero length]; } return nil; } ___ 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: [Xcode 3.1.4] Step Into broken on Leopard
At 12:02 AM -0700 3/25/10, Brian Willoughby wrote: Switch to an Intel Mac, or revert to an older version of Xcode. This was unfortunately broken in the last release of Xcode for Leopard, but only on PPC Macs, and I wouldn't hold your breath waiting for a fix. Thanks. That's the kind of information I was looking for. Any idea which is the last version that works? Xcode 2.4.3 was the last version for 10.4 and 2.5 was the compatibility version which ran on 10.5. I'm pretty sure 2.5 should work. Ah, sources tell me that 3.1.3 is the latest that works and 3.2 went Intel only. So it looks like 3.1.3 is the version you want and you just went one minor release too far. Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: code folding in NSTextView
At 5:46 PM +0100 3/24/10, Martin Hewitson wrote: I guess this is an old chestnut, but a google search didn't reveal any good clues as how one might go about doing code folding in an NSTextView subclass. I would consider trying to use an NSOutlineView instead. You'd have to identify lines which could be folded, in order to make them collapsible, but I think it has the basics of what you need. Jon ___ 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: Trouble forking my project
At 4:48 PM -0700 3/24/10, Dave Carrigan wrote: Actually, a subversion branch is exactly what you want. Not to start the inevitable version control flamewar, but Subversion's branching is weak in comparison to other systems, except cvs of course. Perforce has strong branching and merging also. The newer distributed systems however, git and Mercurial (hg), are *based* on the concept of merging changes between repositories. If you have not examined distributed version control, you deserve to look into them and understand the difference. Branching and merging are the default operations in a distributed system, by making new branches all the time for every feature or bug fix or release, you take all the unfamiliarity out of it and it becomes more understandable and reliable. In addition, merging changes from one line to another becomes trivial. As does deferring other people's disruptive changes until you are ready for them. That said, I'm still using svn myself, but I'm planning on switching. ;) Jon ___ 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: Details and the concepts related to the Nib Window
Whenever we drag an object from the Interface builder to our Nib window (like we do for a controller object), it means that we are instantiating the object of a class or interface. But where actually can i see it being instantiated. What do you mean by see? I presume he means via a breakpoint in the debugger. Typically people put a breakpoint in init and don't see it being hit because init isn't called, initWithCoder is what is used when unarchiving objects from a nib, but that's a tough one to break in. Typically, the first place your Interface Builder objects/delegates get called is awakeFromNib. That's the place to put a breakpoint where you can see the things you created in Interface Builder. Jon ___ 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: NSPredicate to exclude specific elements??
At 7:54 AM -0700 3/21/10, Robert Monaghan wrote: Lets say I have a pile of NSString Paths in an array, where some of them have the word GREEN in the file name. I've been trying to build an NSPredicate which would exclude elements that contain the name.. Every attempt that I have done gives me an exception.. what am I missing?? eg: @(SELF ALL *) NOT (SELF like[c] %@) @NOT (SELF like[c] %@) @SELF !like[c] %@ @SELF NOT like[c] %@ for example give me an NSInvalidArgumentException I have used @%K CONTAINS[cd] %@ successfully. I would expect @%K NOT CONTAINS[cd] %@ to also work. Jon ___ 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: NSString after an UIAlertView..
sorry, I have not spoken in objective C in an email much as you can tell, (tried to translate) my terms of course are all incorrect.. the NSStrings are not instanced in the header, only declared, if that is the proper word... the are given values in the methods. and when an UIAlertView is instanced if that is proper, then afterward, the string instance is out of scope I had made the assumption before that this is normal, but it maybe not normal, I'm looking for a bug in my code, but i don't see anything yet.. basically if i set a string (put something in the string) just before an instance of UIAlertView is created and then released, i look in the string afterward and it is out of scope. Jon. On Mar 19, 2010, at 11:06 AM, Fritz Anderson wrote: I am stymied by imprecision in your questions. ___ 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
NSString after an UIAlertView..
I have a class set up, and in the header file, I have instances of NSString that i want to hang around for all the methods of the class to be able to use...(why they are declared in the header file). when i create an instance of the class to use I have a problem. I create one instance of this class that hangs around while the whole program is executing... or even if it is just called up for a short time.. (this is a view type of class that creates a subView over the main view... .. several of those methods in the class call UIAlertView, and suddenly the information in the NSStrings that i had instanced in the header of the class and am actively using, disappears each time a method calls up a UIAlertView.. i think because it is creating its own subview on top of everything and all the strings instances are lost at that moment... so the question is:what is the best way to keep strings around that i deem important enough to still have them after a call to UIAlertView.?? Jon. ___ 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
MoviePlayer_iPhone sample code in XCode 3.2
I just tried the MoviePlayer_iPhone sample code in simulator 3.2, (i believe i am running beta 2) while it works if you set it to 3.1, as soon as you set it to 3.2, the local' movie no longer plays? can someone confirm, and a possible reason/solution? thanks in advance. Jon. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom View in Toolbar
At 9:56 AM -0700 3/8/10, David Blanton wrote: So I ask again, how does one display a custom view containing controls in a toolbar? Typically, all views are told to draw themselves via - [view setNeedsDisplay: YES] Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird Bug Report on 10.5
At 9:17 AM -0800 3/8/10, Brent Smith wrote: The thing is, im on 10.6, not 10.5. Is my only option to get a dev machine with 10.5 on it? According to the Internet, some people have had success running 10.5 under VMWare on 10.6. For example: http://blog.rectalogic.com/2008_08_01_archive.html Jon ___ 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
UIView as opposed to UIViewController...
I get indications from reading that you shouldn't really subclass UIView in general or to do routine things, and that any time you implement drawRect in the subclass of a UIView, you are taking a performance hit compared to doing some drawing in other ways? is this true, in the case of doing this in the ViewController, is this below more efficient? or better? or what? - (void)viewDidLoad { [super viewDidLoad]; trailersViewPlane = [[UIImageView alloc] initWithImage:nil]; trailersViewPlane.frame = self.view.frame; theBounds = CGRectMake(0, 0, trailersViewPlane.frame.size.width, trailersViewPlane.frame.size.height); [self.view addSubview:trailersViewPlane]; then drawing within an NStimer loop in this added subView inside the viewController? (the subview bounds are as big as the whole view) etc I guess i am not sure which way to go.. (do everything in a UIView subclass, or do everything in a UIViewController subclass.) it doesn't seem like anything you do in the controller, is easy to get to draw in a UIView subclass, and maybe equally hard to get stuff to translate over to the controller if you do a lot of work in the UIView... i'm just lost as to how an NSTimer and a looping set of code should be worked into these two classes.. should it be in the UIView? or the Controller? seems like it should be in the controller, but then really all the work has to be in the controller, since you can't even call the drawRect while in the controller, so what would you do in the UIView? any of that make sense? thanks in advance, Jon. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Getting relative day-of-week name?
I wrote a fully localized calendar control for 10.2 (even supported Japanese properly :-), but stopped supporting it when apple came out with their own official calendar control. At the time I had to roll my own to get the best behavior. It is really easy to do though... For yesterday, today, and tomorrow you just use the built in natural language formatter. For less than 7 days, you use the localized day of the week (%A). I used a month day (%B %e) format for a few months after that (unless there was a year break), and then a month day, year (%b %e,%Y) format for anything too far out in the future, past the new year, or anything before yesterday. Basically, you are building a custom formatter that passes the problem to different built-in formatters depending on how far away the date is. My primary computer is in the shop or I would post the code (I'll try to remember when I get it back). You should be able to figure it out for yourself though... it is only 2 methods IIRC. Might be a little different with the new date objects though, haven't looked at it in a while (I think you have to use unicode syntax now, but the theory should be the same). Thanks, Jon On Wed, 24 Feb 2010 12:04:45 -0800, Rick Mann rm...@latencyzero.com wrote: I'd like to take an NSDate and get a relative day-of-week name. For example, if today is 2/24, and the NSDate is some time on 2/23, it would be Yesterday. If the NSDate were 2/22, it would be Monday. Is there an existing format specifier for this (fully localized, etc)? Or must I roll my own for this? ___ 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
WebView Loading Images from Local Filesystem
Hello, I have a WebView where I am loading html like this: NSString *baseContextFile = [[NSBundle mainBundle] pathForResource:@base ofType:@html]; baseHTMLString = [[NSString stringWithContentsOfFile:baseContextFile encoding:NSUTF8StringEncoding error:NULL] retain]; [[webView mainFrame] loadHTMLString: baseHTMLString baseURL:[NSURL URLWithString:@]]; I'd like to be able to load images using an img tag in my HTML from my ~/Library/Application Support/ directory. I've been trying to use baseURL, but I get strange results when I create a file URL that points to my Application Support directory. The Apple docs seem a little vague on the subject, saying only that the baseURL is A file that is used to resolve relative URLs within the document. If that's true, then I should be able to point the baseURL wherever I want. - (void)webView:(WebView *)someWebView decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id WebPolicyDecisionListener )listener { [listener ignore]; [[NSWorkspace sharedWorkspace] openURL:[request URL]]; } I'm sure that once again I'm missing something basic, but any pointers in the right direction are appreciated. Thanks, -- Jon ___ 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
NSTextView Drag and Drop
Hello, What is the best way to get access to the file that is dropped on an NSTextView. I don't want to embed the file in the view, but I'd like to copy the file somewhere else and add arbitrary text in its place. I'm thinking I should be looking at NSTextAttachment, but I'm not sure if I'm barking up the wrong tree here. Any pointers in the right direction are appreciated. Thanks, Jon ___ 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: Accessing Variables from Multiple NIBs
Well, before this goes any further, I'm going to go ahead and answer my own question here. The problem is that in the code below, I'm actually instantiating two AppController objects, one in each NIB. So, one AppController doesn't have any idea about the other AppController, and can't get to it's string. The solution I've come up with is to replace my window controller class with a simple call to NSBundle to load the NIB, setting AppController as the owner of the second NIB. Then, in IB, I set the identity of File's Owner to AppController, delete the NSObject, and bind the button to the IBAction in the File's Owner. It's great to solve my own problems, I just wish I'd do it before sending out to Cocoa-Dev for help! -- Jon On Jan 16, 2010, at 6:45 PM, Jonathan Buys wrote: Hello, I have an AppController that looks like this: AppController.h: #import Cocoa/Cocoa.h @class PostController; @interface AppController : NSObject { PostController *postController; NSString *theString; } - (IBAction)setString:(id)sender; - (IBAction)viewString:(id)sender; - (void)processString; @end AppController.m: #import AppController.h #import PostController.h @implementation AppController - (IBAction)setString:(id)sender { // Is postController nil? if (!postController) { // NSLog(@Post Controller was nil.); postController = [[PostController alloc] init]; } // NSLog(@Showing %@, postController); [postController showWindow:self]; theString = @The String; NSLog(@Current Selected Site: %@, theString); [self processString]; } - (IBAction)viewString:(id)sender { NSLog(@viewString Method: %@, theString); [self processString]; } - (void)processString { NSLog(@processString Method: %@, theString); } @end I have two XIB files, MainMenu and NewPost. I've dragged an NSObject into each XIB, and set it's class to AppController. In MainMenu, I have two buttons, one bound to the setString action, and one set to the processString action. In MainMenu XIB, I can see theString in the NSLog output. In the NewPost XIB, I have one button bound to the processString method, but from this XIB, every time I run the processString method, theString is null. How can I define a variable (like NSString) in one XIB, and be able to access it from methods triggered from another XIB? I've got a simple Xcode project that shows this problem, if it would help with explaining it. Thanks, Jon PS. Here is the PostController too, just in case: #import Cocoa/Cocoa.h @interface PostController : NSWindowController { } @end #import PostController.h #import AppController.h @implementation PostController - (id)init { if (![super initWithWindowNibName:@NewPost]) return nil; return self; } - (void)windowDidLoad { NSLog(@Nib file is loaded!); } @end ___ 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/jonbuys%40me.com This email sent to jonb...@me.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 Threading problem
I have a multithreaded application using core data. Each thread has it's own ManagedObjectContext as recommended. There is a NSManagedObject which, in addition to a few other attributes, has an object which is stored as binary data and unpacked into a transient attribute when needed. Some data is either gathered or generated from this object (typically an NSString) and then passed to the main thread for display in the UI. Here is the weird part. Even if I retain/copy the NSString, it becomes invalid (deallocated) when the NSManagedObject it came from turns into a fault. This happens even with onjects that are retained by other objects and should be around for the lifetime of the program. Keep in mind that this string is not an attribute of the managed object, but is only generated from an object that is stored as an attribute. I am following standard memory management practices (e.g. I have checked to make sure I am calling -release and not - dealloc in the dealloc method, and the string is being retained in the initWithCoder: method). Luckily, this only happens when the NSString crosses the thread boundary, so that should be a clue as to why it is happening... though I am not sure what that reason is. I am definitely missing something here. Any idea what might be happening? Thanks, Jon ___ 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: NSCoder and CGColorRef
I have a helper function that encodes the component float values and then the decoder creates a CGColorRef back from those. +(void)encodeColor:(CGColorRef)theColor withCoder:(NSCoder*)encoder withKey:(NSString*)theKey { if(theColor != nil) { const CGFloat* components = CGColorGetComponents(theColor); [encoder encodeFloat:components[0] forKey:[NSString stringWithFormat:@%...@.red, theKey]]; [encoder encodeFloat:components[1] forKey:[NSString stringWithFormat:@%...@.green, theKey]]; [encoder encodeFloat:components[2] forKey:[NSString stringWithFormat:@%...@.blue, theKey]]; [encoder encodeFloat:components[3] forKey:[NSString stringWithFormat:@%...@.alpha, theKey]]; } else { // Encode nil as NSNull [encoder encodeObject:[NSNull null] forKey:theKey]; } } I'm still pretty new at this, though, so maybe others will know a better way. nall. On Nov 5, 2009, at 3:59 PM, Alexander Cohen wrote: How would one go about encoding a CGColorRef into a NSCoder? thx AC ___ 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/jon.nall%40gmail.com This email sent to jon.n...@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: Moving from standalone apps to some internet related programming
On Oct 26, 2009, at 3:50 PM, Nick Rogers wrote: Hi, In my some 2 yrs of cocoa programming with cocoa, I have been able to make a main app (which is selling) and a few related small apps. Now I have to make a small utility that would download the appropriate (best) version of main app that would run on the user system by polling for the MacOS type and its ability to run 64-bit apps. I have no internet related programming experience till now. Are there any resources available for a beginner for developing such a utility. How should I proceed? Have you looked at Sparkle? http://sparkle.andymatuschak.org ___ 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
kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region
Hi. I just joined the mailing list and tried to post this last week, but never saw it show up. I'm trying again. I'm getting the message below printed to the console from my application and hope someone knows what might be going on. When this happens I have a view with an NSProgressIndicator which is updating. In my view's drawRect:, I modify the frame of the progress indicator and draw an NSBezierPath and an NSString. There seems to be no actual adverse effect from this message. The progress bar keeps on doing its thing, but I worry there's something bad happening under the hood. This happens fairly often, but isn't 100% reproducible. Thanks for any help. nall. Error: kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region Error: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. So I set the breakpoint and see the stack trace below. In gdb, I looked at the arguments to some of the functions. The NSView in question is the NSThemeFrame for the NSWindow. In frame 3: self: NSRegion {{{61, 298}, {372, 21}}} arg: NSRegion {{{61, 298}, {372, 21}}} In frame 2: arg1: 0x0 arg2: The address looks like an NSObject-type address, but trying to print it in gdb yields: EXC_BAD_ACCESS #0 0x94bee5f2 in CGErrorBreakpoint () #1 0x94c831d8 in CGSGlobalErrorv () #2 0x94a64b61 in CGSUnionRegionWithRect () #3 0x912a2a70 in -[NSRegion addRegion:] () #4 0x912a28c1 in -[NSWindow _setNeedsDisplayInRegion:] () #5 0x911f3548 in -[NSWindow _absorbDeferredNeedsDisplayRegion] () #6 0x911f2113 in -[NSView _sendViewWillDrawInRect:clipRootView:suppressRecursion:] () #7 0x91154ee9 in -[NSView displayIfNeeded] () #8 0x9111e292 in -[NSWindow displayIfNeeded] () #9 0x9114f764 in _handleWindowNeedsDisplay () #10 0x9408eb02 in __CFRunLoopDoObservers () #11 0x9404b65d in __CFRunLoopRun () #12 0x9404ad34 in CFRunLoopRunSpecific () #13 0x9404ab61 in CFRunLoopRunInMode () #14 0x97984fec in RunCurrentEventLoopInMode () #15 0x97984da3 in ReceiveNextEventCommon () #16 0x97984c28 in BlockUntilNextEventMatchingListInMode () #17 0x91125c95 in _DPSNextEvent () #18 0x9112550a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #19 0x910e769b in -[NSApplication run] () #20 0x910df735 in NSApplicationMain () ___ 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
kCGErrorIllegalArgument: CGSUnionRegionWithRect
Hi. I'm getting the message below printed to the console from my application and hope someone knows what might be going on. When this happens I have a view with an NSProgressIndicator which is updating. In my view's drawRect:, I modify the frame of the progress indicator and draw an NSBezierPath and an NSString. There seems to be no actual adverse effect from this message. The progress bar keeps on doing its thing, but I worry there's something bad happening under the hood. This happens fairly often, but isn't 100% reproducible. Thanks for any help. nall. Error: kCGErrorIllegalArgument: CGSUnionRegionWithRect : Invalid region Error: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged. So I set the breakpoint and see the stack trace below. In gdb, I looked at the arguments to some of the functions. The NSView in question is the NSThemeFrame for the NSWindow. In frame 3: self: NSRegion {{{61, 298}, {372, 21}}} arg: NSRegion {{{61, 298}, {372, 21}}} In frame 2: arg1: 0x0 arg2: The address looks like an NSObject-type address, but trying to print it in gdb yields: EXC_BAD_ACCESS #0 0x94bee5f2 in CGErrorBreakpoint () #1 0x94c831d8 in CGSGlobalErrorv () #2 0x94a64b61 in CGSUnionRegionWithRect () #3 0x912a2a70 in -[NSRegion addRegion:] () #4 0x912a28c1 in -[NSWindow _setNeedsDisplayInRegion:] () #5 0x911f3548 in -[NSWindow _absorbDeferredNeedsDisplayRegion] () #6 0x911f2113 in -[NSView _sendViewWillDrawInRect:clipRootView:suppressRecursion:] () #7 0x91154ee9 in -[NSView displayIfNeeded] () #8 0x9111e292 in -[NSWindow displayIfNeeded] () #9 0x9114f764 in _handleWindowNeedsDisplay () #10 0x9408eb02 in __CFRunLoopDoObservers () #11 0x9404b65d in __CFRunLoopRun () #12 0x9404ad34 in CFRunLoopRunSpecific () #13 0x9404ab61 in CFRunLoopRunInMode () #14 0x97984fec in RunCurrentEventLoopInMode () #15 0x97984da3 in ReceiveNextEventCommon () #16 0x97984c28 in BlockUntilNextEventMatchingListInMode () #17 0x91125c95 in _DPSNextEvent () #18 0x9112550a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #19 0x910e769b in -[NSApplication run] () #20 0x910df735 in NSApplicationMain () ___ 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: unsleep the display programatically?
that will work, because that will remind them to change that preference, thanks for doing that. Jon. On Oct 19, 2009, at 1:13 AM, Mark Ritchie wrote: After a short time of no password being entered, the screen will go back to sleep ___ 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
unsleep the display programatically?
can you unsleep the display programatically? i haven't found a method yet for doing it? Jon. ___ 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