Re: UIView as opposed to UIViewController...
Am 07.03.2010 um 03:57 schrieb Jon: I get indications from reading that you shouldn't really subclass UIView in general or to do routine things, and that any time you implement drawRect in the subclass of a UIView, you are taking a performance hit compared to doing some drawing in other ways? No. Where does it say that? A view draws data (like an image) but should know nothing about any model (that is is an image of a person record). A view controller feeds the data (image of person) to its views. So, if you have a special drawing ou need to perform subclass a view and implement drawRect. is this true, in the case of doing this in the ViewController, is this below more efficient? or better? or what? Your example just adds a subview, nothing else. It make no sense for your question as you don’t draw anything. then drawing within an NStimer loop in this added subView inside the viewController? (the subview bounds are as big as the whole view) NSTimer? What? Why? Please explain what you want to do. etc I guess i am not sure which way to go.. (do everything in a UIView subclass, or do everything in a UIViewController subclass.) Usually neither. You share the work between them. Please read this: http://developer.apple.com/iPhone/library/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html it doesn't seem like anything you do in the controller, is easy to get to draw in a UIView subclass, and maybe equally hard to get stuff to translate over to the controller if you do a lot of work in the UIView... If your view has to do a lot of work something is wrong. The view just draws information. It does not work on them. i'm just lost as to how an NSTimer and a looping set of code should be worked into these two classes.. should it be in the UIView? or the Controller? seems like it should be in the controller, but then really all the work has to be in the controller, since you can't even call the drawRect while in the controller, so what would you do in the UIView? any of that make sense? No. Because you did not tell at all what you try to achieve with your timer and view. atze ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hot to move focus to a button?
Hi Kyle Buttons don't accept keyboard focus. See the documentation for -[NSView canBecomeKeyView] and the related conceptual documentation. I realise this to be what the docs say but, if you use -makeFirstResponder: the focus ring is applied to the chosen button and pressing the spacebar calls the connected action, which is, surely, the desired end result of setting focus. Joanna -- Joanna Carter Carter Consulting ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hot to move focus to a button?
On Mar 7, 2010, at 3:53 AM, Joanna Carter wrote: Hi Kyle Buttons don't accept keyboard focus. See the documentation for -[NSView canBecomeKeyView] and the related conceptual documentation. I realise this to be what the docs say but, if you use -makeFirstResponder: the focus ring is applied to the chosen button and pressing the spacebar calls the connected action, which is, surely, the desired end result of setting focus. All you need to do is properly set up the key view loop in IB. i.e. connect the 'nextKeyView' outlets. If your UI is something like this: Prompt: [edit field] (button1) (button2) set 'nextKeyView' of 'edit field' to 'button1'. Then, 'button1' to 'button2' and finally 'button2' back to the 'edit field'. Also, ensure to set the first responder as needed. When Full Keyboard Access is off, users will only be able to tab amongst controls that are text boxes or lists. Otherwise, when on, they will be able to tab amongst all controls. You should get automatic behavior 99% of the time (i.e. you never have to call makeFirstResponder: manually). There are cases where you need to do so when you have very complex UI involving tabless tabviews (usually nested). In response to selected tab changes, you can rewire the keyloop manually as needed and re-establish the current control that should have focus. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hot to move focus to a button?
Hi Ricky All you need to do is properly set up the key view loop in IB. i.e. connect the 'nextKeyView' outlets. ... A very good point. I was assuming that Jonathan already knew this slaps self on wrist :-) and just wanted to set focus to a button, other than by moving through the tab order. Joanna -- Joanna Carter Carter Consulting ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSImageView bindings readonly ?
I wish it was readonly. But it appears to set the value to blank if you drop an image on, unless I'm doing something wrong. RD On 6 Mar 2010, at 16:33, Keary Suska wrote: On Mar 6, 2010, at 6:17 AM, Rich Dearlove wrote: I've been trying to bind an NSImageView to a Dictionary element. I can get the NSImageView to display the image from the valuepath that is in the dictionary, but I would like to be able drop an image onto the NSimageview and have the bindings set the path to the image into the dictionary element. Is this possible ? The valuePath binding is read-only, and would likely too much subclassing witchery to work. It also doesn't seems sensible to use a path. Consider: user drags an image from a Word document. What is the path? Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: cocoa-dev vs. Apple's dev forums?
On Mar 6, 2010, at 10:21 AM, Ulai Beekam wrote: Which one would you prefer (assuming you had 99 bucks to spare each year without trouble) and why? Mailing list over forum any day. Don't make me hunt a bunch of forums every day! x lists, one convenient interface (Mail.app). But my biggest beef: a closed forum will not be indexed by Google. So even if you pay up and the dev forum has a great answer, you will not find it using Google. Gerd ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSURLConnection Asynchronous vs. Synchronous Asymmetry
On Mar 5, 2010, at 7:54 PM, Stuart Malin wrote: I expected the sendSynchronousRequest approach to return an NSHTTPURLResponse object without an error because, according to the docs, the synchronous method is built on top of the asynchronous methods. Yes, but its semantics are different; it's more limited because it doesn't support a delegate. In particular, you can't do HTTP authentication with the synchronous version. Therefore, any 401 response by the server is a fatal error that gets returned to you. But in the async case, a 401 is a recoverable situation because you can implement the authentication method in the delegate API to handle it. In general, the async API does not treat HTTP status conditions (4xx, 5xx) as errors; instead you can check for these in your didReceiveResponse method. But the synchronous version does return those as NSErrors. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: predicate for a Core Data fetch request rejected by SQL
On Sat, 2010/03/06, Joanna Carter cocoa...@carterconsulting.org.uk wrote: This quote from the Core Data Programming Guide: There are some interactions between fetching and the type of store. In the XML, binary, and in-memory stores, evaluation of the predicate and sort descriptors is performed in Objective-C with access to all Cocoa's functionality, including the comparison methods on NSString. The SQL store, on the other hand, compiles the predicate and sort descriptors to SQL and evaluates the result in the database itself. This is done primarily for performance, but it means that evaluation happens in a non-Cocoa environment, and so sort descriptors (or predicates) that rely on Cocoa cannot work. To my mind, this does state exactly what you have found. ? Sounds like 10% information and 90% hand-waving with no exactly about it. The reasonable thing to have in the doc after this is more precise descriptions of the differences, with several examples to show how it would work with and without SQL. But... after several tries searching from the doc home page, fighting the Evil Fremd Javascript, finally finding the right doc, reading through the page, I filed feed-back against the doc page. You should probably file your own, because the likelihood that we'd say things the same way, expressing exactly the same concern, including the same things and leaving out the same things, is tiny. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Xcode 3.2.1 and OCUnit results in selector not recognized
In case someone else is interested - decided to switch to BHUnit. I found out that it's also possible to run tests in console mode which is as fast as OCUnit, it's slower only in GUI mode so appologies to all involved in creating the framework... I'm still moving my tests over, so can't tell for sure, but until now it feels much more reliable than OCUnit. Tom ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hot to move focus to a button?
On Sat, 6 Mar 2010 16:25:57 -0800, Kyle Sluder kyle.slu...@gmail.com said: On Sat, Mar 6, 2010 at 12:20 PM, Jonathan Chacón tyflos2...@gmail.com wrote: How can I move the keyboard focus to a control? Buttons don't accept keyboard focus They do on my machine. It all depends on how the user has set up Full Keyboard Access in the Keyboard prefs. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIView as opposed to UIViewController...
On Sat, 06 Mar 2010 19:57:32 -0700, Jon trambl...@mac.com said: I get indications from reading that you shouldn't really subclass UIView in general or to do routine things, and that any time you implement drawRect in the subclass of a UIView, you are taking a performance hit compared to doing some drawing in other ways? You could be misreading whatever you're reading. Implementing drawRect in a subclass of UIView is *how* you do custom drawing. Besides, don't optimize prematurely. Just write your program and then see what the performance is actually like. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hot to move focus to a button?
On Sun, Mar 7, 2010 at 11:44 AM, Matt Neuburg m...@tidbits.com wrote: On Sat, 6 Mar 2010 16:25:57 -0800, Kyle Sluder kyle.slu...@gmail.com said: Buttons don't accept keyboard focus They do on my machine. It all depends on how the user has set up Full Keyboard Access in the Keyboard prefs. m. Okay, but that is not the default configuration. The OP cannot rely on this behavior. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIView as opposed to UIViewController...
You've misread. The performance note is that if your view does not need to draw, then you should not implement -drawRect:. A view with an empty -drawRect: method consumes more memory and requires more processing time to display than the same view that does not implement - drawRect: at all. But if you need to draw, you need to draw. All other methods of getting content into a UIView (or more specifically the view's CALayer) consume similar processing time in most cases. -- David Duncan @ My iPhone On Mar 6, 2010, at 6:57 PM, Jon trambl...@mac.com wrote: I get indications from reading that you shouldn't really subclass UIView in general or to do routine things, and that any time you implement drawRect in the subclass of a UIView, you are taking a performance hit compared to doing some drawing in other ways? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Using audio file services to extract ID3 tags from an incomplete mp3 payload.
Hello, I would like to take advantage of the audio file services api for extracting ID3 information from an incomplete mp3. At the moment I am downloading just the ID3 portion of an mp3 file (using NSURLConnection), and storing it in an NSData object. I'm trying to use this ID3 data to create an AudioFileID with AudioFileOpenWithCallbacks, by doing this I can use AudioFileGetProperty to extract the tags. However, AudioFileOpenWithCallbacks returns kAudioFileInvalidFileError when I attempt this. I don't know if this error is due to the fact that I need to do some preprocessing on the downloaded mp3 data before passing it to AudioFileOpenWithCallbacks, or if AudioFileOpenWithCallbacks simply does not support incomplete mp3 files. Does anyone have any thoughts? I'm trying to avoid writing my own ID3 parser if possible, and would prefer to not using external libraries/frameworks Thanks in advance! -Rod ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/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 audio file services to extract ID3 tags from an incomplete mp3 payload.
On 08/03/2010, at 8:46 AM, Rod Gutierrez wrote: Does anyone have any thoughts? I'm trying to avoid writing my own ID3 parser if possible, and would prefer to not using external libraries/frameworks I think the basic problem is that the ID3 tags are appended to the end of the audio data in the file, so to read them you either have to download all of the file or somehow request the header, figure out the offset then request the data at the end, which might not even be possible. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using audio file services to extract ID3 tags from an incomplete mp3 payload.
Hi Graham, This is true for ID3 version 1, but for version 2.x the tags live at the beginning of the file. I'm not too worried about not supporting ID3 version 1. Cheers, -Rod Sent from my iPhone On Mar 7, 2010, at 5:53 PM, Graham Cox graham@bigpond.com wrote: On 08/03/2010, at 8:46 AM, Rod Gutierrez wrote: Does anyone have any thoughts? I'm trying to avoid writing my own ID3 parser if possible, and would prefer to not using external libraries/frameworks I think the basic problem is that the ID3 tags are appended to the end of the audio data in the file, so to read them you either have to download all of the file or somehow request the header, figure out the offset then request the data at the end, which might not even be possible. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSDocumentController subclass not instantiated first?
Hello, I have an NSDocumentController subclass in my application which should be used as the main doc controller, but it doesn’t always seem to get loaded before NSDocumentController itself and thus isn’t always returned by NSDocumentController’s -sharedDocumentController. The docs are very clear on how to create an NSDocumentController subclass in such a way that it will be used as the shared object: “To get your application to use your custom subclass of NSDocumentController, you must ensure your subclass is the first instance of NSDocumentController created when the application starts up. There are two ways to do this: 1. Create your subclass in the main nib file. ... 2. Create an instance of your subclass in the applicationWillFinishLaunching: method. ...” (From: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/Documents/Tasks/SubclassController.html#//apple_ref/doc/uid/2953) I thus created an NSObject in MainMenu.nib and set it to my document controller subclass. But the trouble is that despite being instantiated in MainMenu.nib, my subclass isn’t always being used as the shared document controller object (on some launches it is, on others it isn't). The reason for this must be that a standard NSDocumentController object is somehow getting created before my subclass is instantiated in MainMenu.nib. NSDocumentController.h clarifies this: “The first instance of NSDocumentController to be allocated and initialized during application launch is used as the shared document controller.” (I did also try calling [[MyDocumentControllerSubclass alloc] init] in my app delegate’s -applicationWilFinishLaunching:) Running some test NSLogs, it certainly seems that NSDocumentController’s -initialize method is called before that of my application delegate - although I’m not entirely sure that is telling or not. I’ve been through my code looking for calls to NSDocumentController, trying to find any calls that could conceivably occur before MainMenu.nib gets initiated, but so far I’m stumped. Clearly this is something wrong with my project somewhere (a new Xcode document-based project created for testing this worked as expected, with the NSDocumentController subclass instantiated in MainMenu.nib being loaded consistently as the -sharedDocumentController). Somehow, somewhere, a standard NSDocumentController object is being created before my subclass gets instantiated in MainMenu.nib. But how can that be? So my question is, having looked in the obvious places (my NSApplication subclass, my NSApp delegate, and having searched and looked at all occurrences of NSDocumentController being called in my project), does anybody have any tips on where I might look next? I’m a little fuzzy on what gets called before MainMenu.nib is initialised and created, and couldn’t find the relevant information on this in the docs (although I’m sure it’s there and I’m just missing it, so an RTFM link would be much appreciated in that regard). And just in case I’m taking the wrong approach entirely, this is why I’m subclassing NSDocumentController: My app has a templates panel - a new project chooser - much like the one in Pages, that should appear whenever all document windows are closed in my app (again, just like the one in Pages). To do this, I have overridden -addDocument: and -removeDocument: in my NSDocumentController subclass to close the templates panel if a document is added and open it if a the last document is removed. This works well - when my document controller gets loaded correctly. There’s obviously some other factor I’m missing, too, because half of the time my subclass gets loaded fine, the other half it’s only loaded after an instance of NSDocumentController and so the latter becomes the shared object. Many thanks in advance for any pointers on how NSDocumentController might be created before the subclass in MainMenu.nib. All the best, Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: short question but I don't know how to describe it
On Sun, Mar 7, 2010 at 7:07 PM, Marx Bievor mar...@googlemail.com wrote: Hi, I can substitute a String with %@ and an int with %d... like in return @Hi I am %@ and %d years old, name, age; what is the right command to substitute a bool and a float? I cannot find any reference at apple's docs. does anyone have a list of those commands? They're called format specifiers, and they're listed here: http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Strings/Articles/formatSpecifiers.html sherm-- -- Cocoa programming in Perl: http://www.camelbones.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDocumentController subclass not instantiated first?
On Mar 7, 2010, at 16:09, Keith Blount wrote: (I did also try calling [[MyDocumentControllerSubclass alloc] init] in my app delegate’s -applicationWilFinishLaunching:) Can you set a symbolic breakpoint on 'sharedDocumentController' and simply find out when and where it's first called? Also, maybe set one in -[MyDocumentControllerSubclass init] and make sure it isn't returning nil. I don't see any design problem in subclassing NSDocumentController, but, incidentally, I think its 'documents' property is KVO-observable. That might be a simpler route to your goal. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDocumentController subclass not instantiated first?
On Sun, Mar 7, 2010 at 4:09 PM, Keith Blount keithblo...@yahoo.com wrote: Running some test NSLogs, it certainly seems that NSDocumentController’s -initialize method is called before that of my application delegate - although I’m not entirely sure that is telling or not. I’ve been through my code looking for calls to NSDocumentController, trying to find any calls that could conceivably occur before MainMenu.nib gets initiated, but so far I’m stumped. It's important to make a distinction between +initialize (the class method which is sent by the runtime the first time a class is sent a message) and -init (the instance method used to initialize an object). As Quincy says, set a breakpoint on -sharedDocumentController. If that doesn't work, you could load your app up in Instruments and use the Object Graph template to find out where the first NSDocumentController instance is allocated. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bypassing action method in NSSegmentedControl
I have an NSSegmentedControl with 2 segments. The first has a menu set. The second has no menu. I have set a target and action for the whole segmented control. My problem is that I have to hold down the first segment to see the menu for it. By just clicking on it, the action method gets called. (And of course, clicking the second segment calls the action method, as it should, since there is no menu attached to it; so the second segment is fine and is no problem.) How can I force the first segment to show the menu when the first segment gets a mouseDown, i.e. how can I make the first segment act as if there were no target and action set (but of course the target and action should continue to apply for the second segment)? _ Hotmail: Trusted email with powerful SPAM protection. https://signup.live.com/signup.aspx?id=60969___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
problems loading a sound with NSSound
Hello, I added a sound file to the resources of my project ( logoSound.AIF ) I use this function to load the resource: -(NSSound*) getSound:(NSString *) sndValue { NSBundle *bundle = [ NSBundle bundleForClass: [ self class ] ]; NSString *sndName = [ bundle pathForResource: sndValue ofType: @aif ]; NSSound *sound = [ [ NSSound alloc ] initWithContentsOfFile: sndName ]; return sound; } // getSound I do this to load the sound file: NSSound *logoSound = [self getSound: @logoSound]; I try: [logoSound play]; but the sound doesn't play what happend? thanks Regards Jonathan Chacón Barbero Accessibility, usability and new technologies consultant Phone: +34 679953948 e-Mail: jonathan.cha...@telefonica.net Blog: http://programaraciegas.weblog.discapnet.es Twitter: http://www.twitter.com/jonathanchacon LinkedIn: http://es.linkedin.com/in/jonathanchacon Facebook: http://www.facebook.com/jonathan.chacon.barbero Messenger: tyf...@hotmail.com Skype: Tyflos_ Ping for iPhone: jchacon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Transparent background for controls - some problems
Hi, All, I'm trying to create a NSView descendent which could draw a custom bitmap background and which could contain other subviews (like labels and buttons) . The problem that all goes perfectly unless controls will change their state or any another event will cause my view redrawing. When any control changes its state (e.g. label changes its caption) its background is drawn in some incorrect way, which you can see here: http://68.178.246.102/etc/cocoa/test.png Here an empty label is shown after its caption was changed to . I've created a special striped background with holes, randomly set to visualize this effect. Please note, that initially (on startup) all looks just perfectly. Here is my code (its essential part) of my custom view, drawing the background: Here buf is a temporary NSImage, where rectangular piece is created, and bg is the original background of the whole NSView in size. - (void)drawRect:(NSRect)rect { .. rep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil reps = [buf representations]; if (reps != nil [reps count] 0) [buf removeRepresentation:[reps objectAtIndex:0]]; [buf setSize:NSZeroSize]; [buf addRepresentation:rep]; r = rect; r.origin.x = 0; r.origin.y = 0; [buf lockFocus]; [bg drawInRect:r fromRect:rect operation:NSCompositeCopy fraction:1.0]; [buf unlockFocus]; ctx = [NSGraphicsContext currentContext]; [ctx saveGraphicsState]; [ctx setShouldAntialias:YES]; [ctx setPatternPhase:NSMakePoint(0, 0)]; [[NSColor colorWithPatternImage:buf] set]; NSRectFill(rect); [ctx restoreGraphicsState]; } I've tried to save both buf and bg as TIFF's and apply buf on bg in PhotoShop with appropriate shift - all looks exactly, as it should be. The problem is that some controls, like labels, checkboxes and buttons, are drawn somehow outside of this procedure. At least I could not find their rectangles, when I logged rect parameter. Any help would be appreciated. Thanks -Alexander ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDocumentController subclass not instantiated first?
On 08/03/2010, at 11:09 AM, Keith Blount wrote: 2. Create an instance of your subclass in the applicationWillFinishLaunching: method. (I did also try calling [[MyDocumentControllerSubclass alloc] init] in my app delegate’s -applicationWilFinishLaunching:) My app does it this way and it has always worked without any special work needed. I'm not sure what your problem is, but doing it this way works for me, suggesting that the documentation is at least accurate. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: problems loading a sound with NSSound
On Mar 7, 2010, at 8:26 PM, Jonathan Chacón wrote: I added a sound file to the resources of my project ( logoSound.AIF ) I use this function to load the resource: -(NSSound*) getSound:(NSString *) sndValue { NSBundle *bundle = [ NSBundle bundleForClass: [ self class ] ]; NSString *sndName = [ bundle pathForResource: sndValue ofType: @aif ]; NSSound *sound = [ [ NSSound alloc ] initWithContentsOfFile: sndName ]; return sound; } // getSound I do this to load the sound file: NSSound *logoSound = [self getSound: @logoSound]; I try: [logoSound play]; but the sound doesn't play Did you use the debugger to verify that logoSound is not nil when you try to play it? When I tried using NSSound, nobody was able to tell me how to make it work reliably. I ended up using SystemSoundPlay instead (see TN 2102). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com