Re: iPhone Simulator auto-rotation touches detection bug?
On Dec 19, 2009, at 12:53 PM, Matt Neuburg wrote: The iPhone app I'm currently writing is autorotated at startup (see my previous posts on this topic). I've noticed that there's an area about 24 pixels wide at the left end of the iPhone Simulator screen where I don't receive any touches. But the very same app running on my actual device does receive touches there. (All of this has been confirmed with extensive logging.) Since this width is about the height of the status bar, I'm thinking there's a bug in the iPhone Simulator where it fails to move its internal idea of where the status bar is in an autorotated-at-startup app. Is this a known bug? Naturally I'm considering submitting a bug report...! m. It definitely is a bug, and I'm pretty sure it's known, but it never hurts to pile on your vote to increase its importance the the good folks at Apple. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Call Cocoa from C++
On Dec 17, 2009, at 12:16 PM, David Blanton wrote: The question: How / Can I store a pointer to an obj-c object in a C++ class and then send messages to the obj-c object from C++? Somethng like: class MyClass { public: void* objcptr; // ptr to my obj-c object void CallOBJC(void); } MyClass::CallOBJC() { [objcptr updateText]; } Just like that. Put this into a .mm file, and it'll compile as Objective-C++. You'll get a compiler warning that objcptr may not respond to updateText, which you can eliminate by casting objcptr to the appropriate class. I've done this very thing, but from plain ol' 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: Diacritics in Thai
On Dec 17, 2009, at 5:30 PM, David M. Cotter wrote: When I use rangeOfString: options with NSDiacriticInsensitiveSearch not only the tone marks are ignored, but also some vowels. Same problem with NSPredicate someKey =[d] someValue. It is true that in unicode-speak both the tone marks and the ignored vowels are categorized as Nonspacing_Mark. So: is this a bug (eventually to be fixed) or a feature, which all users of the Thai language have to find some workaround themselves? The official way to get someone from Apple to weigh in on an issue is to file a bug, which is the proper route to take if you believe the behavior to be incorrect. how about this: can someone else who knows what they're talking about please confirm that this seems like incorrect behavior? Wow, are you serious?! You're dissing an Apple employee who's pointing you to a valid, *official* venue to get the information you request? Cocoa-Dev is NOT an official Apple support channel. Honey, flies, et al. If this is such an emergency for you, open up a DTS support incident. Good luck, you're gonna need 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
Detect links in UITextView fails on email addresses?
I have 2 UITextViews in a view; one contains a web address, the other an email address. The former, when touched, launches Mobile Safari and loads the web page. The latter, the email address, when touched, does nothing, even though the view has colored it blue and underlined it. If I touch-and-hold, I do get the action sheet asking whether to make a New Message, Create a Contact, etc. Am I wrong in assuming that touching the e-mail address should actually launch Mail and create a new message to that address? Do I have to do anything else besides checking Detect links? Thanks. randy___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
A list for off-topic messages (was Re: File system file renaming question...)
On Dec 8, 2009, at 9:26 AM, Phil Hystad wrote: This question is not specifically about Cocoa programming but I hope that some Mac OS X experts out there can give me an answer. Well, you're probably going to get spanked for doing that. A very good list for these type of Mac-related, but Cocoa-unrelated questions is the Mac-L, Macintosh News and Information mailing list. Subscribe information can be found at http://www.listmoms.net/mac-l/index.html. I'm posting this back to the list so that folks who are inclined in the future to post similar off-topic messages here will have an alternative. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: breakout game - openGL or quartz?
On Dec 6, 2009, at 11:48 PM, Patrick J. Collins wrote: I wrote a breakout style game for actionscript3: http://collinatorstudios.com/dev/super_collins_breakout and it's been on my mind to make a version for the iPhone.. But before I do that, I thought it would be good to just make a version for plain old OS X... So before I do this, I wanted to ask the opinions of every one here-- Should I use OpenGL or quartz/core animation for my graphics drawing? I am thinking that I want to use OpenGL-- even though the game is 2D, I still would like to be able to do gradients and shading and glowing, etc.. Which I am assuming isn't going to be as easy to accomplish with quartz/core animation. I am putting the finishing touches on a 2D game. I started out with Quartz/CA graphics, and while the game was simple enough, I was simply unable to get anything near decent performance. I learned enough OpenGL [ES] in about 15 hours (all from top hits on googling opengl 2d sample code [I think]) to outperform the old code by probably an order of magnitude. Just for grins, I quadrupled the number of objects in my scene (to over several hundred), and I'm still getting 60fps with no problem (I'm actually limiting my frame rate to that, so I'm sure it would be much higher). My scenes are rather simple (no lighting, glowing, or anything), but still...a *remarkable* difference. I decided to leave in a few CA animations because they were so simple, and I really want to ship RSN; this was my first foray into OpenGL, and I'm now a believer. randy___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Image gets wrong resolution value on Snow Leopard
In this application, I have a method that reads in an image and writes it back out with a different resolution. This resolution is specified by the user via a textfield in a sheet. On Leopard, the method works as expected; whatever value for the resolution is specified is what is actually used to write out the image. But on Snow Leopardsigh. The client has asked that this textfield's value default to 250, indicating the image should be written out with a DPI of 250 pixels/inch. When that value is used, the resulting image does NOT have a resolution of 250, but rather 72.05 x 72.03 pixels/inch as indicated by Preview's Info window. GraphicConverter and Photoshop agree with this. I tried various values, including 249, 248, 245, and 239--all these resulted in the wrong value, but lo and behold 240 *works*. I've posted the method at http://paste.lisp.org/display/91743, so you can turn on line numbers for easy reference, but I'll also paste it here for easy discussion: - (void)exportImageDefinition:(AMImageDefinition *)imageDefinition destination:(NSString *)destination retouched:(BOOL)retouched revertRetouched:(BOOL)revertRetouch cropped:(BOOL)cropped revertCropped:(BOOL)revertCrop resolution:(float)resolution recompressed:(BOOL)recompressed fileType:(NSString *)fileType settings:(void *)settings appendExtension:(BOOL)appendExtension writePath:(NSString *)writePath stripMetadata:(BOOL)stripMetadata { NSString *imagePath = nil, *savePath = writePath; BOOL isDir; if (retouched) { imagePath = [imageDefinition retouchedImagePathForSource:retouchedSource]; if (revertRetouch !imagePath) { imagePath = [imageDefinition imagePath]; } } else { imagePath = ((![imageDefinition retouchedImagePathForSource:retouchedSource] || revertRetouch) ? [imageDefinition imagePath] : nil); } if (!recompressed) { // The fileType may be wrong, because it just blindly takes whatever the menu says, without // checking whether it *should* be recompressed or not. NSString *extension = [imagePath pathExtension]; fileType = [self fileTypeForExtension:extension]; } OSType creator = '8BIM' /* Photoshop */, typeCode = [self typeCodeForFileType:fileType]; if ([[NSFileManager defaultManager] fileExistsAtPath:savePath isDirectory:isDir] isDir) { savePath = [savePath stringByAppendingPathComponent:[[imagePath lastPathComponent] stringByDeletingPathExtension]]; if (!recompressed) { if ([imagePath pathExtension] != nil) { savePath = [savePath stringByAppendingPathExtension:[imagePath pathExtension]]; } } } if (recompressed imagePath (!cropped || [imageDefinition regionOfInterest])) { CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath:imagePath], NULL); NSMutableDictionary *imageProperties = nil; NSImage *image = nil; CGImageRefimageRef = NULL; @try { if (CGImageSourceGetCount(imageSource) 0) { imageRef = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); CIImage *ciImage = [CIImage imageWithCGImage:imageRef]; imageProperties = [NSMutableDictionary dictionaryWithDictionary: [(NSDictionary *)CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL) autorelease]]; // clean up after our CGImage CGImageRelease(imageRef); imageRef = NULL; // convert image into nsImage if (ciImage != nil) image = [NSImageCreateWithCIImage(ciImage, imageProperties) autorelease]; } } // clean up @finally { CFRelease(imageSource); imageSource = NULL; } // cancel the export if we can't open the image if (image != nil) { // configure the exporter //[exporter setSettings:settings]; if (appendExtension) { NSString *extension = [self extensionForFileType:fileType]; if (extension != nil) { savePath = [savePath stringByAppendingPathExtension:extension]; } } if (resolution == 0) { // This will be non-zero when cropping has been requested; if it's zero, don't actually // change the value, but use what the current value is. // Could probably just as easily use DPIWidth or TIFF:XResolution or TIFF:YResolution resolution = [[imageProperties valueForKey:@DPIHeight] floatValue]; } if (cropped) { VIImageStyle
Re: Viewing a UIImageJPEGRepresentation image on the desktop
On Oct 22, 2009, at 3:38 PM, The Grand Poohbah wrote: I need to examine an image that was stored in a property list as a NSData UIImageJPEGRepresentation. The property list is a plist file that is sent to me from an iPhone as an email attachment. The image is a Data class item in the property list and stored as a long series of hex bytes. I could view the image on an iPhone because that's how the image was created in the first place (I wrote it), but I'd much rather view it directly on my OS X Mac hardware. Is there a way in OS X to view an image that was stored as a NSData UIImageJPEGRepresentation? What I do often when debugging image issues is, stop in the debugger once I have a handle to the image data (in an NSData object), and make this call in the GDB console (assume imgData is the NSData object containing the JPEG image data): call (BOOL)[imgData writeToFile:@/Users/randy/Desktop/image.jpg atomically:NO] The result (1 or 0) will be printed out, and if 1 the image file can be found on your Desktop. I've also skipped the NSData object completely, when all I have in my code is a UIImage object: call (BOOL)[(NSData *)UIImagePNGRepresentation(myUiImage) writeToFile:@/Users/randy/Desktop/image.jpg atomically:NO] (Disclaimer: written in Mail.app, but it should be pretty darn close to correct.) -- randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: drawing in uiview
On Oct 10, 2009, at 11:41 AM, Jos Timanta Tarigan wrote: i got a very basic question on iphone development. so i add an uiview via IB and try to update it by making my own interface called updateInterface(). in the update interface i put this code: Why would you do that instead of using the UIView method intended to do drawing, -drawRect:? Subclass UIView, and put the following code into it. CGRect frame = [polyView frame]; NSArray*polypath = [[selfclass]pointsForPolygonInRect:frame numberOfSides:[myPolynumberOfSides]]; CGContextRefmyContext = UIGraphicsGetCurrentContext(); int i = 0; CGContextSetRGBStrokeColor(myContext, 0, 0, 1, 1); for (NSValue* value in polypath) { CGPoint point = [value CGPointValue]; if (i == 0) { CGContextMoveToPoint(myContext, point.x, point.y); i++; } else { CGContextAddLineToPoint(myContext, point.x, point.y); } } CGContextClosePath(myContext); im trying to draw a polygon here built by lines from one point to antoher. the pointsForPolygonInRect is working properly but my UIview(polyView) isnt showing anything. i dont really understand what happened up there, i just googled it around working for a proper method. im very new to cocoa-dev so please do a more human language ;) You might also want to actually *draw* the path; see Painting Paths file:///Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_0.iPhoneLibrary.docset/Contents/Resources/Documents/documentation/GraphicsImaging/Reference/CGContext/Reference/reference.html#//apple_ref/doc/uid/TP3950-CH1g-TPXREF107 (you set the stroke color, but then don't actually stroke the path). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Updating application info plist
On Oct 9, 2009, at 3:55 AM, Zephyroth Akash wrote: I get the Info.plist of the app like this. NSMutableDictionary *infoPlist = [[NSBundle mainbundle] infoDictionary]; After the update of some resources I want to write the new version of these resources in the Info.plist. No problem. But when the app execute : [infoPlist writeToFile:pathToInfoPlistOfTheApp atomically:YES]; Nothing happens even if I change the path to my desktop, the dictionary is not written. Are there some limitations ? There are limitations on what types of objects you can put in a dictionary such that it can be written out to a property list file. Specifically, only NSData, NSDate, NSNumber, NSString, NSArray, and/or NSDictionary objects. Any other type of object in the dictionary will cause the write to fail. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Animate a UIImageView's animatingImages?
Is it possible to apply an animation effect to a UIImageView's animationImages? That is, instead of the images switching in a hard fashion, maybe a dissolve transition between them? -- randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Suggestions for debugging “EXC_BAD _ACCESS” [SOLVED]
On Sep 25, 2009, at 5:46 PM, Bob Barnes wrote: Kyle/Nick/Greg, Thank you guys. Took a little digging but the combination of NSZombie instruments object allocation did the job. After years working with Java I find myself tripping over memory management issues much too often. I had allocated a UIButton using buttonWithType: and then later released it without ever having retained it. I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does. Right. Read the memory management guidelines; they outline the (simple) rules pretty well. Basically: You own the object if you receive it via a call that contains new, alloc, or copy, in which case you *must* -release it. An object received via any other call, you do *NOT* own, and must *NOT* -release it unless you first - retain 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
Re: Any way to tell why a window is closing?
On Sep 21, 2009, at 9:15 AM, Scott Ribe wrote: Within -windowWillClose, I need to know whether or not the user clicked the close button on the window. I think you can get the instance of the button, can't you? Then set a custom action on 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
Re: Capturing content programatically
On Sep 19, 2009, at 9:09 AM, Achint Sandhu wrote: Hi, Is there a way to programatically capture content from different applications in osx. As an example, I'd like to be able to get a webarchive of the current web page being displayed in safari. I know this can be done with applescript, but I'm not sure how to go about doing this in cocoa/obj-c. If it can be done in AppleScript, then you can probably use Scripting Bridge--sorry, Apple Event Bridge--if you want to stay in Cocoa/ Objective-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: [myNSWindow setDocumentEdited:dirtyB] fail ??
On Sep 17, 2009, at 4:39 PM, David M. Cotter wrote: i really am stuck on this, i've googled and searched the apple site but can find nothing on this. if anyone has any clue i would be most siked. bouns: free karaoke app for someone who solves this! -dave On Sep 16, 2009, at 10:54 AM, David M. Cotter wrote: when i try to set a breakpoint on setDocumentEdited, the enabled check box shows mixed state, and the breakpoint is never hit. if i try to set it to on it goes back to mixed state so i can't set a breakpoint :( What are the exact steps you use to set the breakpoint? open breakpoints window double click on double click to add symbol paste setDocumentEdited, press return Perhaps setDocumentEdited: (with the trailing colon)? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSToolTipOwner Protocol and Xcode 3.2 build failure in Debug Build Configuration
On Sep 16, 2009, at 1:33 AM, Claudio Wilmanns wrote: In my application, I create ToolTipRectangles. I need to display a custom tooltip (as the object does not have an own -description: method), so I override the following method of the NSToolTipOwner Protocol declared in NSView.h: - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data; My implementation looks like this: - (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(NSString*)userData { NSString* string = [NSString string]; if ([userData isEqual:@myData]) { string = [NSString stringWithFormat:@Patch count: %d, count]; // count is an integer instance variable in the calling class } return string; } Using Xcode 3.2 I constantly get these two **errors** (in Debug Build Configuration) or **warnings** (in Release Build Configuration): 1) /.../PlotController.m:239: warning: conflicting types for '- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(NSString *)userData' 2) /Developer/SDKs/MacOSX10.5.sdk/.../NSView.h:343: warning: previous declaration of '-(NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData: (void *)data' Maybe you should make your implementation signature match the prototype (note the difference between the types of the last argument). The error in the Debug Build Configuration leads to an interruption of the build process, hence I cannot debug my application, **this is my main problem!!!**. Actually, you're main problem is your code doesn’t match the prototype; inability to build and/or debug is merely a symptom. The warning in the Release Build Configuration however leads to a properly built application. After running the application, the expected behavior works well, no issues at all. Sounds like a difference in compiler settings between the two configurations. This, however, is not the problem though. Using Xcode 3.1.3 (and Leopard 10.5.8), there is nor an error neither a warning in both, Debug and Release mode. Everything works fine. The compiler used by Xcode 3.2 is stricter than previous versions.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: coding NSNumber in NSArray?
On Sep 14, 2009, at 10:11 AM, jon wrote: I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? bookMarkNode's coders are below, this object has the one NSNumber, and two NSStrings when i look in the debugger at allItems, the NSNumber is not well defined. thanks in advance, Jon. BookMarkNode *node1 = [[BookMarkNode alloc] init]; [node1 setTypeOfLeaf:[NSNumber numberWithInt:0]]; What does the code for -setTypeOfLeaf: look like? If you're not retaining it in that method then it is getting (auto)released the next time the autorelease pool is drained. Just because the array will automatically retain the node object doesn't mean the NSNumber inside that object will also be retained automatically. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Shark newbie needs help with perf-opt
I'm trying to optimize an iPhone app. I have dozens of objects (as many as 60 at a time) moving around the screen at once. Under certain conditions, these objects will collide, and during these collisions, the rest of the objects (the ones not involved in the collisions) slow down noticeably. I had assumed it was the collision detection code that was causing this problem; I still think so, but the results I'm seeing in Shark beg to differ. I have to believe that it's a matter of interpretation of the Shark data, and I'm hoping someone can set me straight. The objects are moved in as NSTimer callback; after all the objects are moved on screen, collision detection is done, via a nested loop involving all the already-collided objects against all the rest of the objects. When I run an instance of this behavior in Shark, it tells me that 16.9% of the time is spent in object movement, while only 5.0% of the time is spent detecting collisions. The reason I don't think this is correct is because the object movement degrades noticeably in direct proportion to the amount of collisions currently in progress. When the maximum number of objects are moving absent any collisions, the movement is fluid; only while collisions are occurring does the movement degrade (objects involved in collisions are currently only being drawn at a different size (via the frame property being adjusted). So I turned my attention to the movement code. The objects are UIViews, whose -drawRect currently consists of only setting a color and drawing a circle (and takes 8.5% of the CPU time). My original code for this consisted of explicit Core Animation, um, animations, which caused other problems with collision detection. So I changed the movement code to manually calculate where each object should be at a given time, and simply set its center property to move it. Of the 16.9% of the time spent in my move method, more than half of that time (9.3%) is spent in CALayer -setPosition:. I got rid of explicit CA animations, but I guess I'm stuck with implicit ones? Is is possible to disable these on iPhone? I don't really care to have *any* animation done during the move method, as I'm setting the absolute position of the objects where they need to be when they need to be there, so I think I want to get rid of the implicit CA stuff--am I right? I think the reason I'm seeing so much activity in the move method is because that's happening constantly during the run of the program, while the collision detection code happens only sporadically, but clumps enough to slow down the movement code. Reasonable? Am I off my rocker? Am I misinterpreting the Shark data? Any other optimization tips? I'm continuing to tinker with stuff, but while working on that I wanted to post this before I got too far down the road/into the weeds. Thanks. randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Scripting Bridge link error
On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote: You don't actually instantiate ScriptingBridge objects directly like that. The interface header is generated so you can get type checking when you call methods, but the actual class is acquired dynamically at runtime. See the documentation for - classForScriptingClass: in SBApplication. You'll need to do something more like: AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new]; DOH! Totally missed the line Do not use a class name in the sdp- generated header file as the receiver of the alloc method. I'm sure that wasn't there the first time I read the docs! ;) Thanks, Jason. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Scripting Bridge link error
On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote: You don't actually instantiate ScriptingBridge objects directly like that. The interface header is generated so you can get type checking when you call methods, but the actual class is acquired dynamically at runtime. See the documentation for - classForScriptingClass: in SBApplication. You'll need to do something more like: AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new]; OK, now that I've successfully created this options object...what the heck do I do with it?! I create the object in the first place in order to pass it as the past argument to a document's - saveIn:as:copying:appending:withOptions: method. It doesn't really belong to a container object (AFAICT), so when the doc says Immediately after creating the object, insert it in the appropriate element array. The object is not “viable” in the application until it has been added to its container. Consequently, you cannot set or access its properties until it’s been added., I'm at a loss figuring out which container it is supposed to be added to before I can even do options.quality=12; in order to pass it to that method. I'd love to be able to query the document to get this (so that I can do this only if the quality is not already 12), but I've found no way via AppleScript to find this out. Currently, I'm using do shell script to run the command line tool 'exiftool' to query the image file for the PhotoshopQuality EXIF value, but I'd like to avoid this if possible. Any tips would be greatly appreciated! Thanks! randy___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Scripting Bridge link error
I am trying to use Scripting Bridge to do some minor control of Adobe Photoshop CS3 from my Cocoa app. I have followed the instructions in the Scripting Bridge Programming Guide for Cocoa, specifically: 1. Generate header files for all scriptable applications that your code is sending messages to: I used sdef /Users/Shared/Adobe\ Photoshop\ CS3/Adobe\ Photoshop\ CS3.app | sdp -fh --basename AdobePhotoshopCS3 to generate this header. 2. Add these files to your project. (done) 3. In your header or implementation files, add #import statements for the generated header files. (done) 4. Add the Scripting Bridge framework to your project. (done) Here is the modest amount of code I'm using right now: AdobePhotoshopCS3Application *psApp = [SBApplication applicationWithBundleIdentifier:@com.adobe.Photoshop]; if ([psApp isRunning]) { SBElementArray *docs = [psApp documents]; NSUInteger index ; AdobePhotoshopCS3Document *doc; AdobePhotoshopCS3JPEGSaveOptions *options = [AdobePhotoshopCS3JPEGSaveOptions new]; options.quality = 12; for (index = 0; index [docs count]; index++) { doc = [[docs objectAtIndex:index] get]; [doc saveIn:doc.filePath as:AdobePhotoshopCS3SvFmJPEG copying:NO appending:AdobePhotoshopCS3E300NoExtension withOptions:options]; } [options release]; } It compiles fine, but I get this link error: Undefined symbols: .objc_class_name_AdobePhotoshopCS3JPEGSaveOptions, referenced from: literal- poin...@__objc@__cls_r...@adobephotoshopcs3jpegsaveoptions in AMBatchEditMonitor.o ld: symbol(s) not found collect2: ld returned 1 exit status It's in the header file that got generated @interface AdobePhotoshopCS3JPEGSaveOptions : AdobePhotoshopCS3SaveOptions @property BOOL embedColorProfile; // embed color profile in document @property AdobePhotoshopCS3E270 formatOptions; // ( default: standard ) @property AdobePhotoshopCS3E880 matte; @property NSInteger quality; // quality of produced image ( 0 - 12; default: 3 ) @property NSInteger scans; // number of scans. Only valid for progressive type JPEG files ( 3 - 5 ) @end but where's the object code for it? The other classes used (AdobePhotoshopCS3Application and AdobePhotoshopCS3Document) are apparently linked OK, so what gives with the JPEGSaveOptions? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSURLDownload delegate methods seperate thread
On Sep 8, 2009, at 1:03 PM, Colin Deasy wrote: Hey, Is anyone aware of a way to receive NSURLDownload's delegate methods on a separate thread, i.e. not the main one? Delegate messages will be sent on the thread which calls this method. So, start your NSURLDownload on whichever thread you want the delegate methods to be called on. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSBundle from an URL.
On Sep 3, 2009, at 4:36 PM, Erik Österlund wrote: 2009-09-04 00:33:52.657 TestClient[90551:a0f] An uncaught exception was raised 2009-09-04 00:33:52.659 TestClient[90551:a0f] *** -[NSBundle initWithURL:]: non-file URL argument 2009-09-04 00:33:52.663 TestClient[90551:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: non-file URL argument' It doesn't seem to like the fact that the bundle URL is a directory, but what else would it be?! (and yes I have a webserver, and yes the URL is correct) Well, that may be a correct URL, but it is not a file URL, which the exception is all about. I think you need the URL to be of the form file://___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Beep
On Aug 26, 2009, at 10:47 AM, Sumanth Peddamatham wrote: NSBeep(). I've been searching though the iPhone audio API ^^ Impedance mismatch. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: need help about the touch event
On Aug 24, 2009, at 4:42 PM, Gill Bates wrote: Hi All, currently we have three kinds of touch event: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@touchesBegan); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@touchesMoved); } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@touchesEnded); } what if I want to detect the time once user pressed at a specific icon. In particular, I want to implement some feature like iphone on the homescreen, when the user pressed an icon for 2 seconds, the system would show something. So anyone has an idea for this? In the -touchesBegan, set a timer for 2 seconds; in the timer callback, do whatever it is you want to do (jiggle icons, for example). However, if you get a -touchesEnded (or -touchesMoved, as appropriate for your use case) *before* the timer fires, invalidate the timer and carry on as if nothing happened. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 NSColor
On Aug 13, 2009, at 10:33 AM, Daniel Furrer wrote: You are right. (But why?) When/where are you trying to do this? I tried running this in main.m, before calling NSApplicationMain(), and got nil returned from +controlColor. I moved it into an -awakeFromNib call, and +controlColor returned a valid object. That leads me to believe that some connection needs to be hooked up for this to work, and at the time you're calling it (as I did in main.m) that this connection is not configured yet. I'll leave it to smarter gurus here to describe what that connection is. WindowServer? AppKit? On Thu, Aug 13, 2009 at 6:29 PM, Randall Meadows cocoa-...@not- pc.com wrote: On Aug 13, 2009, at 10:24 AM, Daniel Furrer wrote: I'm trying to get the RGB components of a system color. Here's what I've been trying: NSColor* foo = [[NSColor controlColor] colorUsingColorSpaceName: @NSCalibratedRGBColorSpace]; NSLog(@%f, %f, %f, [foo redComponent], [foo blueComponent], [foo greenComponent]); but all I ever get is 0.0, 0.0, 0.0 Also [foo numberOfComponents] seems to be 0. (For [NSColor blueColor] it's working fine however). What am I doing wrong? Sounds like foo is nil. Have you verified that it is a bona fide object in the debugger? -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSWindow reference remains null after window did load
On Jul 27, 2009, at 8:39 PM, Daniel Child wrote: I have a master controller loading a window controller subclass, but for some reason, I cannot get a pointer to the window loaded in the XIB file. I've looked at every connection, and I've also tested the order by of method calls. In the window controller's init: [self window] yields nothing. Likewise in awakeFromNib and windowDidLoad. It's totally mysterious because I have practically identical setups in two other programs, the only difference being that they used nib files and this is xib. But from what I understand, that shouldn't matter. For what it's worth, in the XIB file, the window outlet goes to File's Owner (the window controller subclass). The window contains a table, and (unsurprisingly) [myTable window] also yields nothing. Eventually the window does load, but only in its basic nib-drawn form, ignoring all of the initialization that the controller is supposed to do except for two text fields, which do for some reason get initialized. I've spent hours checking connections and stepping through code. Does anyone have a suggestion where I can look to track down this issue. This came up in another chat I had today. In that case, the window was not set to be visible at launch, so the system deferred actually loading it until it was ready to be shown. Perhaps that's happening to you? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Animation rendering problem
On Jul 23, 2009, at 1:15 AM, David Duncan wrote: On Jul 22, 2009, at 10:05 PM, Randall Meadows wrote: Any idea why the drawing is screwing up for the 2nd animation? Are the 2 different methods of animating messing up each other somehow (even though I've removed the 1st animation)? This is working as expected (for the default case at least). By default a view (or layer) is not redraw when it is resized, but the content is scaled. You want to change the contentMode on the UIView if you want it to redraw (and understand that there is a performance penalty for doing this). That thought actually did occur to me, but I dismissed it for several reasons: 1) The event that causes the explosion is another ball being placed into the view by a click, and everything about this catalyst ball is exactly the same as all the other balls, except it never gets the initial movement animation applied to it. This catalyst ball correctly animates its diameter change animation. B) My interim fix was to remove the original ball view that was moving, create a new ball view with the same properties as the old one and insert it into the parent view, then apply the explosion animation--essentially the same thing as the catalyst ball above. Works great, no jaggies, perfect circle. Again, this object is the same type, created the same way, as all the others, it just doesn't have the initial animation applied to it. That was enough to convince me that there was something else going on, implicating the animation as being part of the problem. Regardless, I changed the contentMode of the animated balls to UIViewContentModeRedraw just to see what would happen, and now it doesn't expand at all. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 Animation rendering problem
Probably not the best subject line, but best I could come up with... I an animating a ball across the screen, using this code: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@position]; animation.duration = duration; animation.delegate = self; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; animation.fromValue = [NSValue valueWithCGPoint:self.center]; animation.toValue = [NSValue valueWithCGPoint:intersectPt]; self.layer.position = intersectPt; [self.layer addAnimation:animation forKey:@position]; No problem. Works great. Now, something happens and I want to stop the motion of the ball, and start a new animation that increases the diameter of the ball. I do so by doing [self.layer removeAllAnimations]; if (speed 0) { self.speed = 0.0; CGPoint here = ((CALayer *)(self.layer.presentationLayer)).position; self.center = here; } to stop the ball in place (which seems to work, as the following animation is done at the correct location) and then I start a new animation that increases the size of the ball, like so: [UIView beginAnimations:nil context:NULL]; { [UIView setAnimationDuration:0.5]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(explosion:finished:context:)]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; CGFloat delta = (kParticleSizeExplode - kParticleSizeNormal); CGRect newBounds = self.bounds; newBounds.origin.x -= delta/2.0; newBounds.size.width += delta; newBounds.origin.y -= delta/2.0; newBounds.size.height += delta; self.bounds = newBounds; } [UIView commitAnimations]; The problem occurs while drawing the ball during this 2nd animation; instead of redrawing the ball at increasing sizes, so it's nice and round, instead it appears that the small ball is simply being scaled up, and is very jaggy. Here's my -drawRect: for the ball: CGContextRef context = UIGraphicsGetCurrentContext(); const CGFloat *components = CGColorGetComponents(self.color); CGContextSetRGBFillColor(context, components[0], components[1], components[2], 1.0); CGContextFillEllipseInRect(context, [self currentBounds]); The -currentBounds method is a convenience method to get the current bounds of the object, whether it is part of an animation currently or not: - (CGRect)currentBounds { CGRect bounds = CGRectZero; CALayer *presLayer = self.layer.presentationLayer; if (presLayer == nil) { bounds = self.bounds; } else { bounds = ((CALayer *)presLayer).bounds; } return bounds; } Any idea why the drawing is screwing up for the 2nd animation? Are the 2 different methods of animating messing up each other somehow (even though I've removed the 1st animation)? Tips/suggestions/comments appreciated. randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SecRandom.h on iPhone OS 2.2.1?
I started working on a new project, and started out using the 3.0 SDK; I'm now far enough along to realize that I don't really need to eliminate older versions, so I switched the Base SDK to 2.2.1. I do, however, use the Security framework, specifically SecRandomCopyBytes() to generate random numbers. For 3.0, this simply required adding Security.framework to my project and #importing Security/Security.h. However, when I switch to 2.2.1 and build the project, SecRandomCopyBytes and kSecRandomDefault are undeclared, even though they are documented as being Available in iPhone OS 2.0 and later. When I look at the Security.framework in my project, SecRandom.h (which is where those two things are documented as being declared in) is not included in the list of files. I found it in the file system, at /Developer/Platforms/ iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/ Frameworks/Security.framework, but when I try to add *this* framework to the project, Xcode *actually* adds /Developer/Platforms/ iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/ System/Library/Frameworks/Security.framework instead. This latter location is where all the other frameworks (Foundation.framework, CoreGraphics.framework, et al.) in the project live, but that Security.framework does not contain SecRandom.h. Is this a situation where it works only on the device, not the simulator? That would suck rocks. Any suggestions are greatly appreciated... randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UIButton image disables shows touch on highlight?
Is it expected, normal, documented(?) that putting an image onto a UIButton turns OFF (in practice) the shows touch on highlight property? For the life of me I cannot get this to work, neither in the simulator nor on the device. Ideas/suggestions? randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Set icon for files created
On Jun 5, 2009, at 5:48 AM, Jerry Krinock wrote: On 2009 Jun 05, at 03:28, Nikhil Khandelwal wrote: How I can set the icon for files created from my application? The short answer is CFBundleTypeIconFile. This, and other important information you'll need to know, is stored in the Info.plist file in the bundle. You can also set a custom icon (say, for an image file) using NSWorkspace's -setIcon:forFile:options:. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Inverting a black and white NSImage
On May 13, 2009, at 4:59 PM, Eric Gorr wrote: I have a black and white NSImage with some pixels in the image totally transparent. I need to change the white pixels to black, the black pixels to white, and leave the transparent area in the image alone. The only solution that comes immediately to mind is to get a bitmap representation of the image, loop over all of the pixels and invert each one by one. Based on the kind of image I am dealing with, this should be just fine. However, I am thinking there is an easier solution, but my mind is drawing a blank - probably because it is getting late and I should go home. Use the CIColorInvert Core Image filter. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Dashboard-style window flip.
On May 7, 2009, at 5:55 AM, Тимофей Даньшин wrote: Hello. This might be a noob question, but I'd like my application to have it's two or three settings to be located on the back of it's window, like widgets in DashBoard do. I've been googling for it, but all i could find was a desperately slow Window Flipper project. Can you recommend me something to that end? Best I could find was Lemur Flip. First google hit.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 remove a clip path?
On May 5, 2009, at 12:47 PM, McLaughlin, Michael P. wrote: In a custom NSBezierView, I fill the view with a background color then set a clip path that will eventually be drawn as a map. I do this so that I can color-code the map (in a complicated way) without going outside the lines. If I then draw the map, external boundaries are drawn as half-width lines because the clip path divides them in half lengthwise. I cannot just double the line width because there are internal map boundaries as well so I would like to *remove* the clip path totally. If I write [[NSBezierPath new] setClip]; this works perfectly except that I get an error in the Console window which I would rather avoid. Is there a recommended way to remove a clip path? Note: Setting the clip path to a dummy path outside the view does not work because then the map will not be drawn at all. How 'bout using +clipRect: with the bounds of the enclosing view? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: High Scores local to iPhone app
On May 5, 2009, at 12:50 PM, Eric E. Dolecki wrote: Probably only 10... however I understand that a plist can't store complex data... how would this work for pairs? Normally I'd only be able to store just a list of scores, not paired with names, correct? Wrong. A plist can contain an NSDictionary, which would contain your names and scores as key/value pairs. It even has a -writeToFile:... method. Easy peasy. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Custom log file for NSLog
I want to have a custom log file for my app, so that my client can send it to me when things go different. In reading the docs for NSLog, it seems that it is just a front-end for asl. So here's what I thought should work: directories = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *logFileName = nil; int result = 0; if ([directories count] 0) { logFileName = [directories objectAtIndex:0]; logFileName = [logFileName stringByAppendingPathComponent:@Logs]; if ([fileMgr createDirectoryAtPath:logFileName withIntermediateDirectories:YES attributes:nil error:nil]) { logFileName = [logFileName stringByAppendingPathComponent:@MyLogFile.log]; int fd = open([logFileName fileSystemRepresentation], (O_RDWR| O_CREAT|O_TRUNC), (S_IRWXU|S_IRWXG|S_IRWXO)); if (fd != -1) { result = asl_add_log_file(NULL, fd); } } } This results in the file being created, but nothing ever being written to it. In Console.app, I can see the messages when I select All Messages, Console Messages, and system.log, but *not* MyLogFile.log. I assume it has something to do with this comment in the docs for NSLogv (which NSLog calls): If the STDERR_FILENO file descriptor has been redirected away from the default or is going to a tty, it will also be written there. If you want to direct output elsewhere, you need to use a custom logging facility. This seems contradictory to the statement that NSLog Logs an error message to the Apple System Log facility. If anyone would like to educate me on my obvious misunderstanding of this, I'd appreciate it. Anyway, I tried it, and yes, redirecting stderr to my log file does put all my NSLogs into my log file. But, it also prevents the messages from being seen in Xcode's Console window. How can I have my cake and eat it too? randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: create object from class name held in String?
On Apr 30, 2009, at 1:50 PM, Darren Minifie wrote: Hi everyone. I have the situation where I need to dynamically create an object based on the value held in a string at runtime. I'm pretty sure the dynamic nature of objective-c would allow this, but I cant seem to find the right method on NSString or NSObject. I want to do this: NSString* someClass = @Dog; Animal* anAnimal = [[someClass alloc] init]; I know this isn't right, but I'm trying to use the value held in someClass as the name of the class I want to instantiate. thanks for the help. Animal *anAnimal = [[NSClassFromString(someClass) alloc] init]; Foundations Functions Reference: file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: 10.4.x install for testing...
On Apr 27, 2009, at 12:17 PM, iseecolors wrote: Does anyone know if Apple provides a download of the full 10.4.x install DVD for developers? I need to test 10.4 on an intel machine, but my install of 10.4 only works on PPC. You should see a disk image in your ADC account, under Downloads, Mac OS X. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Dividing NSView to subviews
On Apr 23, 2009, at 12:11 AM, Naresh Kongara wrote: Hi All, I have a NSView which i want to divide into to required sub views. I implemented it using NSView's dataWithPDFInsideRect: (NSRect )aRect, i.e constructed a image view with the data i got . This process is taking long time if the view is large one.. Is there any other way to get the required part of a View. NSView -bitmapImageRepForCachingDisplayInRect: will grab the specified rect area of the receiving view into a prepared bitmap. Is that what you're looking for? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 find this compile error?
On Apr 23, 2009, at 12:09 PM, James Cicenia wrote: Undefined symbols: _kCATransactionDisableActions, referenced from: _kCATransactionDisableActions$non_lazy_ptr in AudioViewController.o _OBJC_CLASS_$_CALayer, referenced from: __objc_classrefs__d...@0 in AudioViewController.o _OBJC_CLASS_$_CATransaction, referenced from: __objc_classrefs__d...@0 in AudioViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status That's not a compile error, that's a link error. Did you add QuartzCore.framework to your project? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Importing Word doc in Carbon app via Cocoa
On Apr 16, 2009, at 11:43 AM, Jeremy W. Sherman wrote: Foundation memory management for CoreFoundation programmers, in brief: * the Create rule becomes the you own all references returned by a method beginning with new, copy, or alloc * the Get rule becomes you do not own any references returned by a method beginning with anything else pedantic s/beginning with/containing/g /pedantic mutableCopy would not be included otherwise. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: HUD-Style buttons
On Apr 9, 2009, at 8:57 AM, Walker Argendeli wrote: I also found this one: http://code.google.com/p/bghudappkit/ Doe anyone have experience with either one or have a preference? I've used BGHUDAppKit; I'm really satisfied with it, with the exception that it does not understand that scrollbars can be set to have double arrows at both ends, and does not render that correctly. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: static method to create CABasicAnimation: does this create a memory leak?
On Apr 9, 2009, at 6:00 PM, Miles wrote: I have created a static method creating and returning an animation that I use in various places in my application. I think this may be causing a leak. If I autorelease theAnimation in the return statement I get a crash because I the animation must be being release before it's complete. Right, because theAnimation is *already* autoreleased. The method animationWithKeyPath does not contain new, alloc, or copy, therefore you do not own the object, and therefore you are not responsible for (auto)releasing it. Is this indeed causing a leak? No. Might I suggest you review http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043 . ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Check box to indicate more than 2 states
On Apr 7, 2009, at 11:43 AM, Arun wrote: Hi All, I am using check box control in my application to show Enable/Disable status. Is it possible to use the same control to show more that 2 states. Like Enable/Disable/Modified. Any idea? This would be the mixed state of NSButton. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Dragging around an NSImageView
On Apr 3, 2009, at 4:14 AM, Aaron Scott wrote: I'm trying to figure out how to be able to drag an NSImageView around. The NSImageView has been added as a subview to another NSImageView. Basically, I'm trying to drag a grey box around over the top of a picture. I can programmatically move it around but I can't seem to find the right code to allow me to drag it around. You don't actually drag a *view*, you drag an image. Pedantic, perhaps, but important. When you start a drag, you specify the image that will be dragged. See NSView's -dragImage:at:offset:event:pasteboard:source:slideBack:, as well as Dragging Sources in the Drag and Drop Programming Topics for Cocoa reference. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Is there an iPhone mailing list?
On Mar 20, 2009, at 4:39 PM, Steve Wetzel wrote: Hey, I have a UITouch question and I am wondering if there is a mail list specifically for the iPhone. Is there? Well, there is the official developer forum, if you're a registered iPhone developer at https://devforums.apple.com/. If you're not a registered developer, there are other unofficial forums: http://www.google.com/search?client=safarirls=en-usq=iphone+dev+forumsie=UTF-8oe=UTF-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: Notifications and timing
On Mar 12, 2009, at 11:46 AM, McLaughlin, Michael P. wrote: I have a global gFlags variable (unsigned long long) and several objects that need a pointer to it. I fill one such pointer, and reinit gFlags, via the following code: if (flags == nil) { flagPtr *flgH = flags; NSData *flgsDatum = [[NSData alloc] initWithBytesNoCopy:flgH length:sizeof(flgH) freeWhenDone:NO]; [[NSNotificationCenter defaultCenter] postNotificationName:@fetchFlags object:flgsDatum]; *flags = (WORKING | (*flags LOGFILE)); } This code appears to work successfully. My question is whether the notification is responded to in a synchronous manner so that the pointer is guaranteed to be filled in by the time *flags = (WORKING | (*flags LOGFILE)); is executed. NSNotificationCenter Class Reference sez: A notification center delivers notifications to observers synchronously. In other words, thepostNotification: methods do not return until all observers have received and processed the notification. To send notifications asynchronously useNSNotificationQueue. In a multithreaded application, notifications are always delivered in the thread in which the notification was posted, which may not be the same thread in which an observer registered itself. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSSlider changed notification
On Mar 10, 2009, at 12:03 PM, David Alter wrote: Hi All, I'm sure this is something basic that I'm just missing. For some reason I can not find how to get a notification when my slider changes value. I want to be able to subscribe to receive a notification if the slider value changes. Is there a delegate method for this? What is the best way to get this? Is the slider set to be continuous (either check the box in IB or call -setContinuous:YES on it)? If so, then it's action method will be called every time the value changes. If not, then the action method will be called when the user has finished dragging the slider. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Why does releasing this array cause a crash?
On Mar 10, 2009, at 4:35 PM, James Cicenia wrote: NSMutableArray *arraySubType = [[NSMutableArray alloc]init]; OK, this array, you *should* release, yes. Then in a loop from the database I have: while (sqlite3_step(statement) == SQLITE_ROW) { if(![aDict objectForKey: [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)]]){ NSMutableArray *tmpArray = [[NSMutableArray alloc]init]; [aDict setValue:tmpArray forKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; [tmpArray release]; } arraySubType = [aDict objectForKey: [NSString stringWithUTF8String: (char *)sqlite3_column_text(statement, 1)]]; You have now just overwritten the previous value of arraySubType, thus leaking it. You now have a handle to a completely different object, which is autoreleased. This is why when you do release it, you crash later. If you do not use arraySubType between the alloc/init above and this line, then you do not need to alloc/init it, just declare it only. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Save As panel file types popup menu
On Feb 26, 2009, at 1:48 PM, jeff...@aol.com wrote: Hi, Is there a way to restrict what file types show up in the Save As panel popup menu? It's showing all the file types from the Info.plist file, and I want to show just some of them. NSSavePanel -setAllowedFileTypes:? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Using a flip transition to a different view
On Feb 22, 2009, at 9:49 AM, David Hatch wrote: Hi, I'm writing an app that has a view that displays subviews to show information to the user. I would like the user to click a button and have the clicked sub view transition to a different view where the user can edit the information. I want to use the transition that is used with dashboard widgets when the user clicks the i for preferences but, upon looking through the documentation at Core Animation transitions, that was not an available transition. Is there a way I can use the flip transition instead of one of the four included transitions? I had a similar requirement in the app I'm working on, and resorted to modifying Lemur Flip to do the job. It's not nearly as smooth or slick as the Dashboard (or iPhone) animation, but it works (FSDO works). I've been told the same thing can be done with Core Animation (I have to assume that's what iPhone is using to do it); my first (original) attempts failed (having never worked with CA before), and I've not revisited the issue yet to figure it out. Google lemur flip; it's the first hit, but the URL is NSFW, so I'll omit it from this message. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 Undo behavior
In my app's window there is an NSTextView, a place in which to enter notes associated with a selected object. Currently, when the user is finished editing those notes and switches to a different view (like clicking in another text area), I capture that edit session and store the new notes by calling -setNotes: on that object; this creates an Undo action, allowing the user to undo the entire edit session in one fell swoop. I had initially turned on the Undo flag in IB for that text view, so that the user could undo (and redo) sub-edits while the edit session was in progress (Undo Typing is pushed onto the Undo stack by the text view, apparently), while my custom Undo action pushed onto the Undo stack would undo the entire edit session itself (Undo Edit Notes). I find when I do this, with the text view's Undo flag enabled, there is some zombie undo action left on the Undo stack, that does nothing, and doesn't go away. Here's the entire process: 1. Select and object and start typing in the Notes field 2. The Edit menu contains Undo Typing, and does just that--reverts the typing while I'm in still in that text view. 3. If I select Undo Typing, that works, and now the Edit menu contains Redo Typing (there is no Undo available, and it is disabled). Redo works, and the Edit menu contains Undo Typing (and Redo is disabled). 4. With changes in the text view, I click a different text area in the window; this action ultimately causes the object's -setNotes: method to be called, in which I set up the Undo action with the current notes and then update the object with the new notes. 5. The Edit menu now contains Undo Edit Notes (Redo is disabled). 6. If I select Undo Edit Notes, the change is reverted; the Edit menu now contains Redo Edit Notes, but also an enabled Undo item. 7. At this point, I can select Undo as long as I have the patience to continue doing so. Nothing (apparent) happens, I never get to the end of the Undo stack, and *my* Redo Edit Notes Undo action remains available. 8. I can select my Redo Edit Notes, and the right thing happens; the Edit menu goes back to Undo Edit Notes (Redo is disabled) and selecting it again takes me back to step 7, ad infinitum. I can only assume this anonymous Undo action is left over from the NSTextView undo stack (since using that is the only way I can get this to appear). Turning off the Undo flag for that text view in IB makes this all go away. I s'pose I could liberally interpret the customer's specification to make my custom Undo action the right thing to do (and eliminate the undo ability whilst editing the field), but that just doesn't sit right with me. But I haven't been able to figure out why this anonymous Undo action is left on the stack, or a good away to get rid of it, or even figure out what happens when I select it. Any ideas? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
More on Undo and Redo
I think I must be missing something fundamental, or have a misunderstanding to begin with. Or maybe I'm just doing something wrong to begin with... I'm working on an app, implementing Undo features. Undo basics are simple: you supply the Undo manager an object, a method, and some arguments that effectively mirror the operation just [about to be] performed: when changing a yellow object blue, you pass the Undo manager the object, the -setColor: method, and the current color, so that upon invoking Undo the color is changed back to what it was. Nice and symmetrical. However, I have a case where symmetry is not involved. The program manages cards; it uses custom code to manage the backing store file, which is in a cross-platform format (i.e., it uses open, seek, write, close et al, instead of, say, writing out dictionaries). One of the operations I need to support Undo for is Delete Card. When a card is deleted, the data in the file is deleted, and the GUI removes an entry from the array controller managing the display. In order to support Undo, I cache all the pertinent information that the card would normally hold onto, and upon Undo being invoked, I recreate a new card from scratch. (I cannot hold onto the card object itself because it loads its data lazily; data is not loaded from the file until it actually needs to be displayed on screen. So if I held onto the object itself, some fields would be nil, and once the data is deleted from the file, I can no longer get it back in order to restore it. Not that this is really pertinent to my real question...) I have Undo working just great: I delete a card, I cache its attributes with the Undo manager, it gets deleted from the file, it's removed from the display, I Undo, a new card gets created and populated with the cached attributes, saved in the file and displayed, all is well in the world. The problem is Redo. This is not a symmetric operation, like changing the color of an object on screen. All I need to do to Redo is call the method that deletes the card. It seems I need to tell the Undo manager to invoke a different method, with different arguments, when Redo is invoked, but I've not found how to do that. Anyone care to set me straight on this? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: More on Undo and Redo
On Feb 19, 2009, at 9:28 PM, Graham Cox wrote: Undo isn't *required* to be symmetrical. It just happens to be when setting a single property like your -setColor: example. ... Seems to me this is the sort of design you want. Yes, yes it is... On Feb 19, 2009, at 8:29 PM, Michael Ash wrote: I'm afraid I don't understand the difficulty. Well, it turns out (as was pointed out to me in an off-list message-- thanks again, Greg!) the difficulty was me severely over-thinking the issue, and getting off-track by setting up some Undo stuff outside of the method where it really belonged. Fixing that, and cracking open another bottle of Mt. Dew set me straight, and now I've nearly completed the entire task. Thanks for all your feedback! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSCollectionView inside an NSSplitView?
On Feb 13, 2009, at 11:09 AM, Jean-Nicolas Jolivet wrote: I'm having weird problems with a CollectionView inside an NSSplitView... it looks fine but as soon as I re-size (either by dragging the split view's divider or by re-sizing the window) the CollectionView's animation is flickering a LOT, and the items in my collection view are jumping all over the place, from the top of the collection view to the bottom and back to the top... I was wondering if anyone else had problems with NSCollectionView in split views? I'm pretty sure the problem is related to animation... perhaps if I could disable the collection view's animation altogether? Not sure if it's possible... I first noticed the bug using BWToolKit's BWSplitView and I thought it could be a bug with the toolkit, but I tried changing the BWSplitView to an NSSplitView and the same behavior is present... It's really nothing subtle... it really makes the app unusable... is this a known bug? I have a feeling it's related to the problem I had with doing live zooming of an IKImageView; during the live zooming, the animation would stutter constantly, just as you describe, as the zoom factor got set, triggering the animation, and then because it was live zooming, the zoom factor would get set again, again triggering the animation, but the animation was already in progress, so it got b0rked. I was told I should be able to disable the animations, but never could, so I ended up writing my own replacement for the IKImageView that behaved correctly. I have a feeling you're hitting the same (or at least similar) issue. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSPopupButton in NSTableView header?
Is it possible to put a custom view, in this case an NSPopupButton, in a specific column header of an NSTableView? I have a table with 3 columns, one of which displays a status for one of several user-selectable things that correspond to the rest of the data in that row. I currently have the popup button that selects which thing's status is displayed elsewhere in the window, and it's a little confusing, apparently. I thought if I could put that popup button directly in the header of that column instead, it'd be crystal clear. Is it a matter of subclassing NSTableHeaderView, overriding - drawRect:, calling super's -drawRect: first, and then placing an NSPopupButton at the appropriate location (as determined by - headerRectOfColumn: for my special column? That seems like a hack, but it's all I could come up with so far. There doesn't seem to be a way to set a specific cell in the header view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSPopupButton in NSTableView header?
And OF COURSE I find the answer not 10 seconds after pressing Send...NSTableColumn -setHeaderCell:. Silly me, I was looking in NSTableHeaderView. What was I thinking?! ;) On Feb 11, 2009, at 1:40 PM, Randall Meadows wrote: Is it possible to put a custom view, in this case an NSPopupButton, in a specific column header of an NSTableView? I have a table with 3 columns, one of which displays a status for one of several user-selectable things that correspond to the rest of the data in that row. I currently have the popup button that selects which thing's status is displayed elsewhere in the window, and it's a little confusing, apparently. I thought if I could put that popup button directly in the header of that column instead, it'd be crystal clear. Is it a matter of subclassing NSTableHeaderView, overriding - drawRect:, calling super's -drawRect: first, and then placing an NSPopupButton at the appropriate location (as determined by - headerRectOfColumn: for my special column? That seems like a hack, but it's all I could come up with so far. There doesn't seem to be a way to set a specific cell in the header view. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Objective-C question
On Feb 10, 2009, at 10:16 AM, Andy Bettis wrote: I have an id object that I'd like to test to see if it's a certain class or a subclass of that class. isKindOfClass gives a very specific test, is there an easy way to test for an object being a subclass of a class? That's exactly what -isKindOfClass: gives you. From the docs: Returns a Boolean value that indicates whether the receiver is an instance of given class or an instance of any class that inherits from that class. Notice the last phrase. Also note the warning that the docs give about using this on a class cluster. -isMemberOfClass: is what you initially describe. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
High-quality image upscaling
I have to upscale JPEG images from 72DPI to, say 250DPI (user- selectable). I figured Core Image would be the way to go, but... The CI docs for CILanczosScaleTransform say You typically use this filter to scale down an image; well, I will be needing to scale the image UP. What filter is appropriate for that? CIAffineTransform? You can scale...the input image. Will that give me a high-quality scaling? When I do a similar operation in Photoshop (Image - Image Size, Resolution), it offers to resample the image, and offers Bicubic Smoother as being best for enlargement. What's the Cocoa/CI equivalent to that? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Getting *my* object out of a tree controller?
I have an NSOutlineView backed by an NSTreeController. selectedObject = [[treeController selectedObjects] objectAtIndex:n] gives me back an object (of the type) that I expect. However, when I then try to find where that object lives in the tree [treeView rowForItem:selectedObject] returns -1 (not found). I ultimately need to remove the object from the tree controller (using -removeObjectAtArrangedObjectIndexPath: presumably), but how do I get an index path to an object when I have *just* a pointer to that object? I can get an index path to the selection, but in this case, the object to be deleted may not actually be selected in the view. Based on the stuff I discovered below, I assume I need to be searching for the tree node representation of my object? How do I get that just from the object itself? Or do I need to remember that tree node information at the same time I get a handle to the object? Thanks! randy - OK, I figured out the following part: NSTreeControllerTreeNode must be a NSTreeNode, on which I can call -representedObject, which returns me an object of the type I expect; I left the rest in here in case I'm mistaken somehow, someone can set me straight. Even when I query the tree controller directly for its items, I don't get *my* object types back, but rather NSTreeControllerTreeNodes: (gdb) po [treeView itemAtRow:1] NSTreeControllerTreeNode: 0x2a4a00, child nodes {} (gdb) po [treeView itemAtRow:0] NSTreeControllerTreeNode: 0x2d82b0, child nodes { 0:NSTreeControllerTreeNode: 0x2a4a00, child nodes {} 1:NSTreeControllerTreeNode: 0x2a4fb0, child nodes {} } Not only can I not find any documentation on this type, I can't even cmd-double-click or search to find *any* mention of it at all. Casting that to my object type was an exercise in futility (what was displayed was obviously not a valid object). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Restoring selection to NSOutlineView
Man, I'm feeling dumb today...NSOutlineView/NSTreeController is kicking my butt... I'm trying to determine a sane new selection for when I delete the currently selected item in an NSOutlineView. I'm failing. My thought was to get the index path of the item I deleted, then try to select that same index path, thinking that that would now be the next sibling if there was one, and the selection method would return NO if there was no next sibling (since the index path would be invalid). However, if I've just deleted the last sibling (and thus there is not next sibling), the selection method (-setSelectionIndexPath:) actually returns YES, because instead of *not* changing the selection because the index path is invalid, it changes the selection to nothing because the index path is invalid (thus necessitating the YES return value). If there was no next sibling, I was going to try to select the previous sibling, if there was one, and only if there wasn't, then proceed to select the deleted item's parent (if there was one). But I can't get this far, because of the problem described in the previous paragraph. So, it seems like I need to try to get the actual *object* pointed to by the index path and see if there is a valid object there, but I can't figure out how to do that, either from the NSOutlineView or its backing NSTreeController. Any ideas? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSProgressIndicator not accepting updates
On Jan 22, 2009, at 3:31 AM, Aaron Wallis wrote: As an example, i've got a controller which has a NSProgressIndicator bound to it through IB, and on the awakeFromNib method I've got a little bit of code: double tD = 0.5; [progressBar setDoubleValue:tD]; NSLog(@%d, [progressBar doubleValue]); %d print integers, not doubles. now when I run the application the progress bar is just doing it's barber shop thing and no progress is indicated. Have you called -setIndeterminate:NO on the progress bar, or otherwise unchecked the Indeterminate checkbox in IB? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSTextView and front/middle/back ellipses
On Jan 22, 2009, at 11:03 AM, Harry Plate wrote: I have a simple text view that will display its text information with an ellipses on the right (end) if the string is too long for the view. Nice, but... How can I tell NSTextView to use a front or middle ellipses for viewing purposes? You'll have to set a (mutable) paragraph style, and specify NSLineBreakByTruncatingHead or NSLineBreakByTruncatingMiddle for the NSLineBreakMode using -setLineBreakMode:. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Observing edits make to a table using bindings
Perhaps I just can't get my head around the terminology sufficiently to search on the right thing...feel free to enlighten me. I have an NSTableView, whose content is supplied through bindings to an array controller. Column A is supplied via FieldListController.arrangedObjects.name, Column B via FieldListController.arrangedObjects.value; column B is editable, column A is not. I'm trying to observe when a cell in Column B is edited by [thing addObserver:self forKeyPath:@fieldList options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:nil]; When I edit a field (by double-clicking it) and commit the edit (pressing Return), in my - observeValueForKeyPath:ofObject:change:context: method, keyPath is fieldList and object is the object that owns the fieldList that is being observed. The NSKeyValueChangeKindKey in the change dictionary is NSKeyValueChangeSetting; NSKeyValueChangeNewKey and NSKeyValueChangeOldKey are both arrays containing all the observed fields in fieldList. But those fields are not the values that are being edited, they are the objects which contain the values that are being edited (i.e., [field value] is what's getting edited (and [field name] is what's displayed in Column A). OK, so all that makes sense, in that I'm observing fieldList, and the notification hands me an array (which is fieldList). However, it doesn't tell me *which* field in the array was edited; I have to iterate over all the fields, comparing the values from old and new to figure out which specific field was edited. I tried changing the observed keyPath to @fieldList.value, but that only succeeded in having the table not display anything at all (which doesn't make sense to me either). Is it possible to know exactly which array element was edited, without registering observers on the entire contents of the array? I figure it has something to do with the keyPath, but the exact something has thus far eluded me. Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: UTIs and type codes and extensions
On Jan 14, 2009, at 7:48 AM, Sean McBride wrote: On 1/14/09 2:31 AM, Julien Jalon said: I'm just making sure I'm not missing something... There's no system-defined way to go from a UTI to an old-style file type code (which the UTI docs seem to refer to as a tag) and back again, am I correct? extern CFStringRef UTTypeCopyPreferredTagWithClass( CFStringRef inUTI, CFStringRef inTagClass) AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER; Note that none of the 'UT...' functions are documented in Xcode's built- in viewer, but browsing through the .h's reveals good header documentation. Whew. So I'm not losing it. (Well, not in this particular case, anyway...) Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
UTIs and type codes and extensions
I'm just making sure I'm not missing something... There's no system-defined way to go from a UTI to an old-style file type code (which the UTI docs seem to refer to as a tag) and back again, am I correct? For instance, my app can export files as TIFF, JPEG, or PNG. When the user makes the selection, I convert the selection popup menu to the appropriate UTI using the defined constants in UTCoreTypes.h (kUTTypeTIFF, et al). I'd like to generalize the subsequent code to take that UTI (public.tiff for example) and convert it to the appropriate type code ('TIFF'). The next logical step would be producing a file name extension based on that as well (public.tiff - tif). *All* this information is contained in the table at http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html#//apple_ref/doc/uid/TP40001319-CH205-CHDIJFGJ , but I could discern no way to actually do these types of conversions in a general manner. History: The reason I need to do this is, Photoshop is brain-dead when it comes to opening image files that happen to have no extension in the filename (and no file type code). Preview, QuickTime Player and GraphicConverter (and sometimes Safari) have NO problem identifying and opening the exact same files, sans extension, but PS simply says Could not complete your request because Photoshop does not recognize this type of file. I am working around this by attaching type and creator codes to all the image files I export. (Yes, my client could avoid all this by simply including an extension to the image name, but old dogs, new tricks, and all that...) Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Disabled button looks like enabled
On Jan 12, 2009, at 11:20 AM, Donnie Lee wrote: As others have already asked: what are you trying to accomplish? I try to create a disabled button that looks like enabled button :))) It's so easy to understand, why do you ask more more and more???!!! Because, frankly, that doesn't make any sense (to put it nicely), and they're asking WHY you want to do that in anticipation of giving you a better solution. They've given you a great answer, which you've rebuffed, and now you're scolding them for *continuing* to try to help you. Not exactly the Dale Carnegie method... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Detecting mouseover in an NSActionCell subclass
On Jan 12, 2009, at 12:56 PM, Jean-Nicolas Jolivet wrote: I've got it all working at this point, the 2 buttons on the right are just NSImages and I'm using startTracking, continueTracking and stopTracking, with my buttons Rect, to detect if they were clicked on... However, I was wondering if it's possible to track when the buttons are moused over so that I can display an alternative image? I've seen countless apps doing it... the best example I could give is Safari's Download window, where you have a little Magnifying glass icon on the right (The Reveal in Finder button)... this is exactly what I'm trying to achieve... Check out the Photosearch sample code http://developer.apple.com/samplecode/PhotoSearch/index.html ; it helped me figure this out when I needed to do mouse tracking in a table cell. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSBezierPath
On Dec 20, 2008, at 11:35 AM, Amr Nashaat wrote: does anyone knows how can I use the NSBezierPath function NSBezierPath is not a function, but anyway... to create a circle? + (NSBezierPath *)bezierPathWithOvalInRect:(NSRect)aRect where aRect describes a square. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Using a NSCollectionView in a table cell.
On Dec 18, 2008, at 9:52 AM, Corbin Dunn wrote: On Dec 18, 2008, at 7:28 AM, Eric Gorr wrote: I need to be able to use a NSCollectionView inside of a cell for a NSOutlineView. [snip] You will have more problems and trouble attempting to get an NSView inside of a cell. I suggest subclassing NSTextFieldCell. Please do log a bug requesting the ability to easily put views into cells. Not that Corbin's advice really needs any validating, but I just tried to do a very similar thing (putting an NSView into a table cell), and ended up NOT doing so after much headache. I ended up doing all custom drawing instead. Myself, I'm off to file that bug... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using a NSCollectionView in a table cell.
On Dec 18, 2008, at 10:06 AM, Eric Gorr wrote: On Dec 18, 2008, at 11:52 AM, Corbin Dunn wrote: On Dec 18, 2008, at 7:28 AM, Eric Gorr wrote: You will have more problems and trouble attempting to get an NSView inside of a cell. I suggest subclassing NSTextFieldCell. Please do log a bug requesting the ability to easily put views into cells. Thanks for the advice. Searching more through the archives, I did find: http://www.joar.com/code/body.html which seems to do what I want and subclasses a NSCell. Could you provide some information on what problems I will run into going the route suggested by joar? I filed the bug - rdar://6455493 Mine's #6455498. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTrackingAreas, mouse entered/exited not firing
Yet another simple operation I've apparently managed to miss something with... I have an NSTableView subclass (actually, a subclass of BGHUDTableView), that contains a bunch of custom cells. For a couple types of those cells, I want to switch the cursor while it's in that cell. I'm following the code in the PhotoSearch sample project that's been mentioned here a couple times recently. I've overridden -updateTrackingAreas in my table class, and I can see it adding the correct rect relative to the appropriate view, with options (NSTrackingEnabledDuringMouseDrag | NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways). I've called [[self window] setAcceptsMouseMovedEvents:YES]; from the table subclass's -awakeFromNib. But -mouse[Entered|Exited]: is not being called when I move the mouse into those areas. On a whim I even overrode -acceptsFirstResponder to return YES, but still no joy. Any ideas? Thanks. randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSTimer help
On Dec 17, 2008, at 10:23 AM, Eric Lee wrote: I have an application, and when I exit the window, the timer doesn't stop, so the application freezes. Is there something similar to -(void)awakeFromNib but for stopping a timer when a window closes? You can register any object to listen for NSWindowWillCloseNotification, and invalidate the timer in the callback. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: The Ages Old __MyCompanyName__ Question
On Dec 17, 2008, at 9:32 AM, Phil Hystad wrote: OK, I am fairly new to Xcode and Cocoa programming and I want to change the __MyCompanyName__ template macro definition. So, I google this question, find answers, and try it out. It did not work. So, is there something different in today's Xcode that means the procedure for changing __MyCompanyName__ is different. I think the most recent entry I found (with a date) was 2005 or so. The procedure I tried was to set ORGANIZATIONNAME in the PBXCustomTemplateMacroDefinitions key of the Xcode plist. First, I could not find it by looking at the plist. So, I tried the defaults command from the shell and this seemed to work but no change in behavior on Xcode in spite of cycling Xcode and trying a number of other things. So, How do you change __MyCompanyName__? defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ ORGANIZATIONNAME = Your Company, Inc.; }' works (I just tested it again in Xcode 3.1.1). You have to quit Xcode and *then* run this for it to work, though. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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 Animation glitch
OK, not a good subject line, but I couldn't come up with anything more descriptive. I hope I can explain the issue clear enough...I'm a fair Core Animation newbie... (I know this is long, sorry, but if nothing else, watch the video linked at the end, and see if that rings any bells.) I have integrated the Lemur Flip code (http://tinyurl.com/ 4ftovo*)into my Mac program, to simulate the same sort of view flipping as seen on the iPhone. (See, for example, the Stocks app on the iPhone, when you press the (i) button at the bottom left, and then the Done button.) I reworked it such that it uses my existing views, not using an overlay window like the Lemur Flip code uses. It's working pretty darn good, kudos to Mike Lee for this. Doesn't look quite as good as the animation on the iPhone, but it's still nice. Anyway, the issue crops up *after* this animation finishes. Here's my set up: The 2 views I'm flipping reside in the same parent view (obviously); one view is smaller (maybe 200pix wide by 300 pixels high), the other takes up almost the entire area of the parent view (about 400x500). Also in that parent view is a button that I use to initiate the flip. This button is at the very top of the view hierarchy, drawn on top of everything. However, when the animation flips from the small view to the larger view, the button is no longer drawn. I can still click on where it's supposed to be and it works, it's just not drawn. The weird thing is, the button is visible all the time *during* the animation (as the animation is being rendered behind the button); it's only after the animation completes that it disappears. The - animationDidStop:finished: delegate method that gets called at the end doesn't appear like is should have any affect on my button; in fact, I did not change that code *at*all* from the Lemur Flip sample code. I can enlarge the window, and since the button is bound to the corner of the window, and the animated views are of a fixed size, I can see the button slide out from underneath the large view, even though I can click on it *through* the view! If I take out the section // Although the back layer seemed to rotate forward, in reality it's still flipped. [CATransaction begin]; // Since this is already our assumed state, do not animate this [CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions]; // Remove all transforms by setting the identity (standard) transform frontView.layer.transform = CATransform3DIdentity; backView.layer.transform = CATransform3DIdentity; [CATransaction commit]; then the button stays drawn on top of everything, as it should, but then, of course, the view is drawn backwards (as indicated by the comments in the code)! Can anyone set me straight on why my button is getting buried beneath a view after the animation, yet is still clickable? Here's a video screen capture I took of it behaving like this: http://www.not-pc.com/CoreAnimationGlitch.mov . Thanks a bunch! randy *-Sorry for the use of a TinyURL there, but there's profanity in the URL, and I'd like to hit as many folks as possible with this posting without it getting delayed or bounced or whatever because of that. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Consistent scroll-to-visible of text view?
I have a table that contains representations of various types of data. As a row is selected another view changes to show details of that data. For instance, some display images and some display text in an NSTextView. As I change from one row to the next, I populate the detail display area with the relevant detail data. When I populate the text view, it was always displaying the text view scrolled to the bottom, presumably because that's where the insert point was left after I inserted the text into the view. Fine, I'll just stick [notesView scrollRangeToVisible:NSMakeRange(0, 0)]; in there, after I insert the text, before it gets displayed. BOOL wasEditable = [notesView isEditable]; [notesView setEditable:YES]; [notesView selectAll:nil]; [notesView insertText:textToDisplay]; [notesView setEditable:wasEditable]; [notesView scrollRangeToVisible:NSMakeRange(0, 0)]; Well, now it alternates between being scrolled to the beginning of the text and being scrolled to the end of the text on subsequent row selections. It'll keep alternating as long as I keep changing the selection. And, it seems to be sensitive to manual scrolling as well: If, when it's scrolled to the top, I manually scroll it to the bottom, change the selection and then come back, the alternating now picks up with it being scrolled to the top again, in an opposite phase. What am I missing to always start the display of this newly-unhidden text view with it scrolled to the top such that the start of the text is always visible? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Double KVO notification
I'm trying to track down (in a project I inherited, not wrote) why a KVO notification is being sent twice. The reason I care is because, the table contains a variety of types of data, and for one particular type of data I need to do something special when it is selected, and then revert that when any other type of data is selected, and this double-notification is screwing things up. Here's the stack trace: -[CLController observeValueForKeyPath:ofObject:change:context:] at CLController.m:448 NSKVONotify -[NSObject(NSKeyValueObservingPrivate) _notifyObserversForKeyPath:change:] -[NSController _notifyObserversForKeyPath:change:] -[NSController didChangeValueForKey:] -[NSTreeController _didChangeValuesForArrangedKeys:objectKeys:indexPathKeys:] -[NSTreeController _selectObjectsAtIndexPathsNoCopy:avoidsEmptySelection:sendObserverNotifications :] -[NSTreeController _selectObjectsAtIndexPaths:avoidsEmptySelection:sendObserverNotifications :] -[NSTreeController setSelectionIndexPaths:] -[NSObject(NSKeyValueCoding) setValue:forKey:] -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error :] -[NSBinder setValue:forBinding:error:] -[NSOutlineViewBinder tableView:didChangeToSelectedRowIndexes:] -[_NSBindingAdaptor tableView:didChangeToSelectedRowIndexes:] -[NSTableView _enableSelectionPostingAndPost] -[NSTableView mouseDown:] -[NSOutlineView mouseDown:] -[NSWindow sendEvent:] -[NSApplication sendEvent:] -[NSApplication run] NSApplicationMain main at main.m:13 Notice my code only shows up at the last call, in response to the notification; the keyPath for each notification is the same. Can anyone give me any tips on how to track down why this notification is being sent twice? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: proper way to release a static NSMutableDictionary?
On Dec 15, 2008, at 3:54 PM, John Michael Zorko wrote: Hello, all ... Imagine this: static NSMutableDictionary *lookup = [NSMutableDictionary new]; ... now imagine a situation where I need to clear that dictionary. [lookup removeAllObjects]; is probably your best choice. If I call [lookup release]; lookup = [NSMutableDictionary new]; ... it will obviously be faster than coding a for loop and removing each object in the dictionary, Maybe marginally; that release is going to cause a -release to be sent to every object in the dictionary anyway, although Apple's implementation is likely optimized. My suggestion above prevents another object creation. but since it was declared as static, which is safer? I don't think safety matters either way, in this case. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSTableView Selection
On Dec 12, 2008, at 11:02 AM, David Blanton wrote: How do I keep the first row in a table view from being selected when the table first loads? The issue is that to get a selection did change for the first row I have to first select a different row because the first row is 'auto selected' when the table first loads. NSTableView delegate method -tableView:shouldSelectRow:? Return NO when row == 0. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Loading a view XIB with different owner types?
I have a view XIB (basically a customized NSTextView) whose File's Owner is configured to be class Foo. I would like to reuse that same XIB in a different part of my code, but the loading owner is a completely different class, Bar. I tried adding the same outlets that Foo has to Bar, and then loading the XIB using Bar as the owner, but that didn't work--the outlet didn't get connected. That's kinda what I expected to happen, actually, but I was hoping... Is it possible to load a single XIB using different owner types, or do I have to duplicate this view XIB for each different type of owner I want to use it with? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Funky behavior with layer-backed views
In this one window I have, I have 2 views and 2 buttons, all living in the same parent view (there's more than just that, but these are the relevant bits). The Notes button shows/hides the notes view, and the Info button shows/ hides the MoreInfo view. I have turned on Wants Core Animation Layer for the parent view containing these items, so that I can animate the showing/hiding of them as appropriate. When the Info button is pressed to show the MoreInfo view, I need to hide the Notes button, and I also do this by animating the opacity of the Notes button to 0 and then actually hide it, therefore I need the Wants Core Animation Layer turned on for the parent view. This seems to have a bad side effect: The z-ordering of the Notes button and the MoreInfo view appears to be swapped, but only kind of. What happened before I added this animating was, the Info button is pressed and the MoreInfo view was shown; the MoreInfo view happened to cover the majority of the window, and in fact occupied the space of the Info button, but it was behind the button so that the button was seen overtop the MoreInfo view. Now that I've turned the CA layer on, when the MoreInfo view is shown, it is now covered up *visually* by the MoreInfo view, but the Info button is still clickable, even though it cannot be seen. If I stretch the window wider, the size of the MoreInfo view stays the same, but the button is bound to the corner, so it moves out from under the MoreInfo view. So it's being drawn, but being drawn under the MoreInfo view, but it gets the clicks instead of the MoreInfo view. Does that explanation of what's happening make sense? I tried adding [showInfoBtn display]; in the animationDidStop:finished: delegate method, to try to force the Info button to redraw itself in the correct location, but that had no effect. What is it about CA layering that is causing this, and how do I get my button (which is on top of everything) to actually be *drawn* on top of everything. Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Arggg...overrelease in table view cell, but where?
Still fighting with the table view custom cell...sorry for the length of this, I'm trying to include as much info as I can to help you help me figure this out. I have subclassed NSTextFieldCell (NSTFC) so that I can do custom drawing in my table cells (basically multiple text strings within the cell). My datasource object maintains an NSMutableArray, which gets populated each time the user selects a something in the rest of the UI. -numberOfRowsInTableView: simply returns the number of objects in the array. -tableView:objectValueForTableColumn:tableColumn:row: simply returns the object at index row of the table. In -tableView:willDisplayCell:aCellforTableColumn:aTableColumn:row:, I set a couple of instance variables in my NSTFC subclass using properties that are set to (readwrite, retain), so they are available in the -drawInteriorWithFrame:inView: method, such as aCell.cellObject = [tableValues objectAtIndex:rowIndex];. I have implemented -copyWithZone in my NSTFC subclass as such: - (id)copyWithZone:(NSZone *)zone { MyTableCell *copy = [super copyWithZone:zone]; copy.cellObject = [self.cellObject copy]; copy.gridController = [self.ViewController copy]; return copy; } All the rows fit into the visible area of the table (no scrolling). Everything fine so far? I can get it to crash by selecting a third row of the table. First selection, OK; 2nd selection, OK; 3rd selection, boom: -[GFController release]: message sent to deallocated instance 0x16d97890 Doesn't happen if I select row 1, then 2, and then 1 again; it has to be 3 different rows. Here's the stack trace: #0 0x94568907 in ___forwarding___ #1 0x94568a12 in __forwarding_prep_0___ #2 0x938c320f in NSPopAutoreleasePool #3 0x95dc7b8c in -[NSApplication run] I can also get it to crash with this message: [GFController name]: message sent to deallocated instance simply by resizing the window. This crash happens in my -tableView:heightOfRow: delegate method. I have NSZombieEnabled turned on. I'm obviously over-releasing something, but I've added in a bunch of retains trying to create a leak, but I'm still stuck with this zombie. Anyone got any more tips on how to track this down? (I thought I recalled seeing a pretty good tutorial on how to use NSZombieEnabled and friends and get a stack trace of where the zombie instance came from, but now I can't find it. I thought it was part of TN2124, but I don't see it in there now. For instance, if I turn on MallocStackLogging, how then do I get the malloc trace?) Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Arggg...overrelease in table view cell, but where?
Of course, right after posting I figured something out. If I return a retained object from -tableView:objectValueForTableColumn:row:, all the crashes go away. I took out all my extra retains I added in, and it's still behaving. But now I'm confused. Based on the standard memory management rules, I should be returning an autoreleased (or a non-retained?) object, right? Is the table view doing a release on the value I return, or is there still something I should be tracking down? I'm sure I must be missing something, but I sure would like to be educated. Thanks. randy On Dec 11, 2008, at 1:24 PM, Randall Meadows wrote: Still fighting with the table view custom cell...sorry for the length of this, I'm trying to include as much info as I can to help you help me figure this out. I have subclassed NSTextFieldCell (NSTFC) so that I can do custom drawing in my table cells (basically multiple text strings within the cell). My datasource object maintains an NSMutableArray, which gets populated each time the user selects a something in the rest of the UI. -numberOfRowsInTableView: simply returns the number of objects in the array. -tableView:objectValueForTableColumn:tableColumn:row: simply returns the object at index row of the table. In -tableView:willDisplayCell:aCellforTableColumn:aTableColumn:row:, I set a couple of instance variables in my NSTFC subclass using properties that are set to (readwrite, retain), so they are available in the -drawInteriorWithFrame:inView: method, such as aCell.cellObject = [tableValues objectAtIndex:rowIndex];. I have implemented -copyWithZone in my NSTFC subclass as such: - (id)copyWithZone:(NSZone *)zone { MyTableCell *copy = [super copyWithZone:zone]; copy.cellObject = [self.cellObject copy]; copy.gridController = [self.ViewController copy]; return copy; } All the rows fit into the visible area of the table (no scrolling). Everything fine so far? I can get it to crash by selecting a third row of the table. First selection, OK; 2nd selection, OK; 3rd selection, boom: -[GFController release]: message sent to deallocated instance 0x16d97890 Doesn't happen if I select row 1, then 2, and then 1 again; it has to be 3 different rows. Here's the stack trace: #0 0x94568907 in ___forwarding___ #1 0x94568a12 in __forwarding_prep_0___ #2 0x938c320f in NSPopAutoreleasePool #3 0x95dc7b8c in -[NSApplication run] I can also get it to crash with this message: [GFController name]: message sent to deallocated instance simply by resizing the window. This crash happens in my -tableView:heightOfRow: delegate method. I have NSZombieEnabled turned on. I'm obviously over-releasing something, but I've added in a bunch of retains trying to create a leak, but I'm still stuck with this zombie. Anyone got any more tips on how to track this down? (I thought I recalled seeing a pretty good tutorial on how to use NSZombieEnabled and friends and get a stack trace of where the zombie instance came from, but now I can't find it. I thought it was part of TN2124, but I don't see it in there now. For instance, if I turn on MallocStackLogging, how then do I get the malloc trace?) Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40not- pc.com This email sent to cocoa-...@not-pc.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: Table view containing cells with both an image and text
On Dec 10, 2008, at 1:41 PM, Corbin Dunn wrote: On Dec 10, 2008, at 11:54 AM, Eric Gorr wrote: I need a column in my NSTableView with cells that contain both an image and some text. My first inclination is to subclass NSCell and have my subclass manage both a NSImageCell and a NSTextFieldCell. Basically, I would imagine would override: - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView and have it call drawWithFrame on the internal image cell and text cell with the appropriate frames. Then, assuming I am on the right track, is it also then correct that what - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn*)aTableColumn row:(NSInteger)rowIndex would return is what NSCell's setObjectValue gets called with? Can't think of any reason why this wouldn't be the case... Yeah, you are right, that is the case. However, I'd recommend subclassing NSTextFieldCell and having it draw an image. It'll make other stuff work for you automatically (cell expansion tooltips, type selection). See: http://developer.apple.com/samplecode/PhotoSearch/ I'm working through this exact thing right now. Couple things I noticed: - that example uses an NSOutlineView instead of an NSTableView, but close enough, withsome translation... - the cellFrame passed into -drawInteriorWithFrame:inView: is not really the interior of the frame; I've had to do cellFrame.origin.x -= 1, cellFrame.origin.y -= 1, cellFrame.size.width += 3, cellFrame.size.height += 1; to actually completely fill the cell, otherwise I get a white border around the edges (since I'm filling the cell with a custom dark color). I gather I must be doing something wrong, or not doing something I should be, but doing the above completely fills the cell whereas the default value doesn't. One additional question I have (sorry, Eric, don't mean to hijack your thread): in my -drawInterior... method, I draw an attributed string with an NSFont attribute of LucidaGrande-Bold 13.00 pt. P [] (0x16b8c4e0) fobj=0x16b8c450, spc=4.28, however, it sure looks like it's drawing in non-bold, instead. I compared it with a LucidaGrande- Bold 13 point sample in TextEdit, and it's vastly different. I could see something changing behind my back when I simply pass an attributed string back as the object value, but how is that being done when I'm drawing it explicitly? attrs = [NSDictionary dictionaryWithObjectsAndKeys: NSFontAttributeName, [NSFont boldSystemFontOfSize:13.0], NSBackgroundColorAttributeName, [NSColor blackColor], nil]; nameRect = NSInsetRect(cellFrame, 2, 0); attrStr = [[NSAttributedString alloc] initWithString:name attributes:attrs]; [attrStr drawInRect:nameRect]; Screenshot of this (blue) versus TextEdit: http://www.not-pc.com/LucidaGrande-13.png ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Table view containing cells with both an image and text
On Dec 10, 2008, at 2:41 PM, Corbin Dunn wrote: On Dec 10, 2008, at 1:14 PM, Randall Meadows wrote: - the cellFrame passed into -drawInteriorWithFrame:inView: is not really the interior of the frame; I've had to do No; it really is! You're this close to convincing me! :) cellFrame.origin.x -= 1, cellFrame.origin.y -= 1, cellFrame.size.width += 3, cellFrame.size.height += 1; Yeah, you don't want to do this; you will have re-draw issues when the cell is invalidated. It sounds like you want to set the - intercellSpacing to 0,0, or override the -drawRow/drawRect method and first fill in the area with a solid background color. Essentially, what you are doing is undoing the intercell spacing. OK, I set intercellSpacing to (0,0), take out my hack, and: (gdb) p (NSSize)[controlView intercellSpacing] $1 = { width = 0, height = 0 } (gdb) p (NSRect)[controlView bounds] $2 = { origin = { x = 0, y = 0 }, size = { width = 425, height = 460 } } (gdb) p (NSRect)aCellFrame $3 = { origin = { x = 0, y = 0 }, size = { width = 422, height = 18 } } Notice the cellFrame is still 3 pixels narrower than the table view itself. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Custom NSTableView cells
I could use a little guidance, please, on customizing cells for display in an NSTableView. (My app is Leopard-only.) I looked around the Apple docs and cocoadev, but didn't really find anything useful. Other pointers would be appreciated. My table has but one column, but each cell in that column is made up of 2 or more views. I think I have what I need as far as the cells go, but it's feeding them to the table view that's giving me problems. I know the required datasource methods are -numberOfRowsInTableView: and -tableView:objectValueForTableColumn:row:; the first is a no- brainer, the 2nd one stumps me. I assume I must implement -tableView:dataCellForTableColumn:row: to feed the table my custom cells for each row, right? What purpose then does the -tableView:objectValueForTableColumn:row: method serve? What should be returned from that if I'm already feeding ready-made cells from the other one? (This table is not editable, so I do not need to worry about -tableView:setObjectValue) The docs also say that my cells must properly implement - copyWithZone:, but I don't know what properly means in that context. Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Drawing a string with a clearColor background
I know I've seen a discussion of this, but my search-fu is weak today, apparently. Please feel free to reply in links to the answer, if you wish... I'm trying to draw (in a view's -drawRect: method) a string over top an image background: NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: font, NSFontAttributeName, textColor, NSForegroundColorAttributeName, [NSColor clearColor], NSBackgroundColorAttributeName, nil]; [text drawInRect:textBounds withAttributes:attrs]; draws the string in the correct text color and font, with a black rectangular background. I want the background image to show through the holes in the string I'm drawing. I tried adding [[NSColor clearColor] set]; NSRectFill(textBounds); before the -drawInRect: call, to no avail. What am I missing? Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Drawing a string with a clearColor background
On Dec 8, 2008, at 3:17 PM, Rob Keniger wrote: On 09/12/2008, at 7:31 AM, Randall Meadows wrote: If you don't set the background at all the text should draw with no background. DOH! Of course the simplest answer is the correct one. Thanks a bunch. randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Programmatically adding an NSTableView to another view
I have configured a view .xib with an NSTableView; I load the nib and add the table view to another parent view. I've implemented the necessary delegate and data source methods. It's all working just peachy, except... It's placement in the parent view is wrong, and I can't figure out how to place it correctly. In the .xib file, I've configured all 4 exterior sizing connections to be struts, both interior sizing connections to be springs, for the view, the scrollview, and the table view. [NSBundle loadNibNamed:@FlexViewTable owner:self]; [view addSubview:tableView]; (tableView is an outlet defined in self and connected to File's Owner in the xib; all the connections look right when I view them in gdb) As the tableView fits into the view, it occupies about 90% of the space (there are 2 other views that take up the rest, both above the table). However, there are usually very few rows in the table, and instead of row 0 being towards the top of the view with all the extra space at the bottom of the view, instead, all the rows are compressed towards the bottom of the view, with the last row exactly at the bottom of the view and all the extra space above the table. Row 0 moves up in the view as there are more rows added to the table. Like so: --- -top of view [view header][icon] | | | empty space | | | --- |row0 | |row1 | |row2 | |row3 | |row4 | |row5 | --- -bottom of view I've tried subclassing NSTableView and returning YES from -isFlipped:, but that did nothing (useful). I've tried playing around with the springs and struts in the view xib, but not found the right combination yet. Is there something else I should be doing to move that table up and move the empty space down? I imagine this is going to be another DOH! moment, so feel free in reveling in the moment of pointing out my dumb mistake (it's been a lon day). Thanks! randy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to extract individual icons from icns file?
On Dec 4, 2008, at 12:16 PM, David wrote: Is there a tool available to extract individual icons from an icns file? In particular the smaller ones. I've tried several tools but none of them work with the 16x16 size. I've seen Linux and Windows tools but no Mac tools. How can that be. Is there a better place for me to ask this question? /Developer/Applications/Utilities/Icon Composer.app handles all sizes. I think Preview.app does as well. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to extract individual icons from icns file?
On Dec 4, 2008, at 2:08 PM, I. Savant wrote: On Thu, Dec 4, 2008 at 3:58 PM, I. Savant [EMAIL PROTECTED] wrote: Might be what you get, certainly isn't what I got. Great. Now open the newly-created file in Photoshop (as if you were going to do something with it such as creating a branded folder or something similar). :-) After Mike contacted me off-list to let me know he didn't have Photoshop but Acorn and others show the image perfectly well, I tried opening in Pixelmator and it appears just fine there as well. So ... this appears to be nothing more than a Photoshop bug! :-) Sorry for the noise. Most of my graphics work is done in Photoshop, so I never noticed the artifacts only appeared there. Well there you have it, David (OP), copy and paste from the desired file from Icon Composer or Preview and it should work fine ... as long as you don't intend to open the result in Photoshop. :-D To throw another monkey wrench into your conclusion, I opened it in PS CS3, and it looked just fine. I did save from Preview as a PNG, dunno if format (or version) makes a difference. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Determining unreleased objects after Quit
On Dec 3, 2008, at 9:38 AM, Jon C. Munson II wrote: Namaste! In my application, when I choose File-Quit, the application appears to terminate. HOWEVER, it doesn't. SOMETHING(s) is(are) left unreleased. Is there a handy way to determine what the object(s) is(are)? When your app quits, all of its memory used it released back to the system. However, your deallocs and such will NOT be called, since that would be a waste of time since everything's going to be released back to the system anyway. It's a shortcut, and usually is in your best interest. It can, however, bite you in certain situations, specifically non- memory resources that you need to do something with at termination. In my case, I needed to release access to a camera, so I had to do some of my cleanup work in -applicationWillTerminate:. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Special Characters Edit Menu Item
On Dec 3, 2008, at 3:41 PM, Randy Bradley wrote: David, I think there must be a way since this menu item doesn’t show up in my Entourage compose mail window.To be honest, I never noticed this before. It seems to me that there are many cases where special characters are not appropriate. If it really bothered me I guess I would try to delete all the menu items at windowDidLoad or some such and then repopulate. I'm guessing Entourage is not a Cocoa app? That's probably why. (And a mail compose window would definitely be a place where you'd want to be able to insert special characters...)___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Button title irregularities
I am porting an iPhone app to the Mac, and the client desires the exact same look-and-feel on the Mac as they have on the iPhone. So I am doing some custom drawing to achieve that. It's mostly going OK, but I've found myself wasting far too much time on this one little detail, and it's killing me... I'm drawing a button with a custom background, and setting an attributed title on it. There is no border, custom background image for both normal and alternate states, and a title for both normal and alternate states. When I set an attributed title on it, using a custom font, custom paragraph style (necessary to center the title), and a custom color, the text of the title is shifted down 1 pixel when compared to the standard button. Thinking that that 1 pixel difference was due to the different font, I tried again, setting an attributed title that *only* contain the custom color. This time, the title was shifted UP 1 pixel from that of a standard button (2 pixels higher than with the fully attributed title). I tried playing around with the line spacing of the paragraph style, but that made no difference. You can see for yourself in this image: http://www.not-pc.com/Buttons.png . (The custom background was not drawn and the border was added to make it easier to see.) Here's the code I'm using to create the button: button = [NSButton new]; [button setButtonType:NSToggleButton]; [button setBezelStyle:NSRegularSquareBezelStyle/ *NSRoundRectBezelStyle*/]; //[button setBordered:NO]; NSDictionary*attrs; NSMutableParagraphStyle *style = [NSMutableParagraphStyle new]; [style setAlignment:NSCenterTextAlignment]; [style setLineSpacing:10]; attrs = [NSDictionary dictionaryWithObjectsAndKeys: // labelFont, NSFontAttributeName, [NSColor blackColor], NSForegroundColorAttributeName, // style, NSParagraphStyleAttributeName, nil]; [button setAttributedTitle:@Show attributes:attrs]; Is there anything standard I can do to fix this? Yeah, I know 1 pixel isn't that much of a difference, but that's like a 5% error, and it's noticeable. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Button title irregularities
On Dec 2, 2008, at 5:31 PM, Aki Inoue wrote: You're using Helveitca 12.0 as your label font. Actually, it's: (gdb) po labelFont ArialMT 12.00 pt. P [] (0x001c0e30) fobj=0x162670a0, spc=3.33 Use [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize: [yourButton controlSize]]] instead. And I'm using that because that's what my client used on their iPhone app, and they want the Mac app to have the exact same look and feel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSIndexSet
On Nov 21, 2008, at 8:44 AM, David Blanton wrote: How would one construct an NSIndexSet containing the indices 2,4,5 ? I did: NSRange two = NSMakeRange(2, 1); NSRange four = NSMakeRange(4, 1); NSRange five = NSMakeRange(5, 1); NSRange u1 = NSUnionRange(two,four); NSRange u2 = NSUnionRange(u1,five); id indices = [NSIndexSet indexSetWithIndexesInRange:u2]; But, of course, NSUnionRange adds 3 so indices becomes 2,3,4,5. Use an NSMutableIndexSet: NSRange range = NSMakeRange(2, 4); NSMutableIndexSet *mutSet = [[NSMutableIndexSet alloc] initWithIndexesInRange:range]; [mutSet removeIndex:3]; And if for some reason you really need it as a non-mutable version: NSIndexSet *set = [[NSIndexSet alloc] initWithIndexSet:set]; Compiled in Mail.app; caveat emptor. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Fastest way to resize an image?
On Nov 19, 2008, at 11:51 PM, Ken Ferry wrote: however I found out that just using the setSize: method of NSImage was unreliable -[NSImage setSize:] doesn't change the pixels of an image, it changes the natural size that the image is drawn at. If you try to write the NSImage back out as a TIFF, say, then what you've done is modify the DPI. Does setting -setScalesWhenResized: appropriately help in this situation? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Code-sign Services HotKey Modifications
On Nov 18, 2008, at 7:44 AM, Xavier Snark wrote: I have a pure cocoa application that relies on Services as its primary method of invocation. Of course it can be opened normally, but that decreases its usability by design. I had already started down the path to allowing the user to change the Services hotkey since I can't predict which applications they will be using and what key-combinations will be taken. They need a way to customize the key-combination to their environment once they start using it. Since Apple wants all of us to sign our code moving forward in Leopard it is not clear to me how I can have both signed code and let the user change the hotkey combination after the application is signed and shipped since the hotkey is stored in Info.plist (or did that change and I haven't seen that documentation?). I will have to sign the code if I want to access the keychain. I would want access to the Keychain since I want to change the Info.plist and it is planned to live in /Applications. I would think you'd want to store the user's preference using NSUserDefaults, not rewriting your bundle at run-time. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Interface Builder Wiring Objects
On Nov 17, 2008, at 11:09 AM, Greg Deward wrote: Good afternoon! I am trying to learn Cocoa and am having difficulty remembering which direction to CTRL-drag controls to wire up the controls in Interface Builder. For example, dragging from my button to my App Controller (NSObject) or vice versa. Does anyone have a way to explain this that might make it stick? Aaron Hillegass, in his Cocoa Programming for Mac OS X book explains it this way: Now you are going to introduce some objects to each otherTo introduce one object to another, you will control-drag from the object that needs to know to the object it needs to know about. So, for instance, a class needs to know about its NSButton outlet, so you control-drag from the class to the NSButton in the window (to set the IBOutlet). The NSButton needs to know what method to call when it is pressed, so you control-drag from the button to the class (to set the IBAction). Or do what Luke said in his response... :) It seems to me that a button should make a call to my App Controller when the click event is fired; therefore I should CTRL-drag FROM the button TO the NSObject. This would allow me to select the appropriate Received Action (ie, doSomething, etc.). Yep, sounds like you have the basic gist of it... However, if I need to do something with a text box (read from it) and a table view (insert an item), I should go the other way... since I'm going to fetch from the text field and then insert into the NSArray that is feeding the text view. But, what triggers the action of reading from the text field and inserting that into the array that feeds the table (you said text, but I assume that's a typo) view? A button gets pressed? The user presses Enter? You set the action of the object that does that action just as you would otherwise. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]