cocoa

How to add NSDebug.h and use NSZombie in iPhone SDK

I want to enable NSZombies for my iPhone app. I have read several articles online and I am still unsure of the exact procedure. I know I have to set the Environment Variables, which I have done: NSZombieEnabled = YES NSDebugEnabled = YES NSDeallocateZombies = NO I think (I'm not sure), I have to import NSDebug.h. When I check the head...

iPhone different between self and normal variable

HI all, What is difference betwin self.myVariable = obj and myVariable = obj, when i use @propery/@synthesize for it ...

Tips for reducing Core Animation memory usage

So here's the situation: I have a CALayer that is the size of my screen, and I'm setting the contents property to a 2 Mb JPEG that's roughly 3500 x 2000 pixels in size with a resolution of 240ppi. I'd expect there to be a slight overhead involved in using the CALayer, but my sample application (which only does exactly what's above) sho...

Implementing "scrubby sliders" in Cocoa?

How would I go about implementing something along the lines of "scrubby sliders", like in Photoshop and quite a few other image-processing applications? They are slightly hard to describe.. basically you have a regular numeric input-box, but you can click-and-hold the mouse button, and it functions like a slider (until you release). If ...

Halting In Progress CAKeyframeAnimation

I'm animating a UIView's frame property using a CAKeyframeAnimation on the view's CALayer and animating the "position" property. I'd like to be able to halt the animation at it's current state when the user taps the screen, but I'm unable to do so. I can halt the animation easily enough by calling [view.layer removeAnimationForKey:kFra...

Constants in Objective C

I'm developing a Cocoa app, and I'm using constant NSStrings as ways to store key names for my preferences. I understand this is a good idea because it allows easy changing of keys if necessary. Plus, it's the whole 'separate your data from your logic' notion. Anyway, is there a good way to make these constants defined once for the whole...

How to implement gradient button bar in Cocoa

Some Cocoa applications (for instance, Mail and Automator) have a special control usually in the bottom of their window: Could you share the best practices of making the same action bar with standard images and popup buttons? Thanks. ...

adding objects to nsmutable array, but the array is still empty

Hi, I am learning Objective-C and have hit a snag. I have created a custom object called "Baddie". I am trying to add the object to a couple of mutable arrays. Baddie *b1 = [[Baddie alloc]initWithTag:4444 pos:cpv(450,270) dir:cpv(0,1)]; [baddieArray addObject: b1]; [baddieWaitingArray addObject: [[Baddie alloc]initWithTag:4447 pos...

Display logging output in Cocoa

What is the best way to display constantly updated logging output using Cocoa Components? The output is line-based and generated by the application. Appending lines should be fast, and the view should automatically scroll to the bottom. All in all, it should work and look like basic standard out in a terminal. My code is written in Pyth...

iphone - Programmatically set (System-wide) proxy settings?

I am new to iPhone development, so I'm sorry if this is a stupid question. I am developing an application whose purpose will be to route all iPhone activity through my company's proxy. Is there a way to programmatically set system-wide proxy settings in the iPhone (which will also take effect on the 3G connection)? I know there is a w...

Remove correctly selected NSManagedObjects

Look at this great screenshot and I think you can imagine what I could ask... The players: to the right: the preferences-panel and a NSTableView to the left: main-window with a NSPopUpButton (under the NSMenu ;] ) The selected object of the popup is binded to one of these in the tableview. This ugly thing (what you can see th...

Easiest way to convert a NSString to its currency equivalent in Cocoa

I have a NSString value of @"78000". How do I get this in currency format, i.e. $78,000 with it remaining an NSString. ...

how to get the path and url of the temp image ?

I capture a image of webview that playing a flash. Because I want to show this image and use the IKSaveOptions to save the image .but I found the path of image is nil, Now I want to get the path of image , How to do ? my code: NSString *path = [[NSBundle mainBundle] pathForResource: ?? ofType:??]; NSURL *url = [NSURL fileURLWithPath: pat...

How do you test your Cocoa GUIs?

I would like to write some tests for the GUI of my Cocoa program. Is there any good GUI testing framework for Cocoa apps? The only thing I found is Squish, which, at 2.400€, is well beyond my budget… Any ideas? How do you test your Cocoa GUIs? ...

iPhone or Cocoa: Handling order of multiple HTTP requests

When working with Cocoa/Cocoa-Touch and the iPhone SDK, a typical convention is to build a client which speaks to a server-side web server. One common problem I face when programming is making multiple HTTP requests in sequence, sometimes up to 5-6 requests. The order in which the requests are made is not linear in which they will return...

NSManagedObjectContextObjectsWillChangeNotification

Hey! I need something like an opposite to NSManagedObjectContextObjectsDidChangeNotification. Something like NSManagedObjectContextObjectsWillChangeNotification. I think this would solve this problem (stackoverflow-question). It's importent that it notificates before it deletes the object (in that problem) for changing the selected NSMen...

What is the type of an enum whose values appear to be strings?

I am working with Apple's ScriptingBridge framework, and have generated a header file for iTunes that contains several enums like this: typedef enum { iTunesESrcLibrary = 'kLib', iTunesESrcIPod = 'kPod', iTunesESrcAudioCD = 'kACD', iTunesESrcMP3CD = 'kMCD', iTunesESrcDevice = 'kDev', iTunesESrcRadioTuner = 'kTun'...

Checking state of Caps Lock in Cocoa

OK. I'm starting my first OS X application. Instead of doing something obvious or simple, I'm going straight to the system stuff. I would like to place a caps lock indicator in the menu bar. In C# or Delphi (my primary languages) this is fairly trivial. In Mac OS X, I'm not really sure where to start. Of course I've downloaded Xcode a...

Need help with animation on iPhone

I'm working on an animated clock application for the iPhone, and I have to pivot all the 3 nodes in the view, which I have obtained in the following code: [CATransaction begin]; [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; clockarm.layer.anchorPoint = CGPointMake(0.0, 0.0); [CATransaction commit]; [...

observeValueForKeyPath:ofObject:change:context: doesn't work properly with arrays

I have an object that implements the indexed accessor methods for a key called contents. In those accessors, I call willChange:valuesAtIndexes:forKey: and didChange:valuesAtIndexes:forKey: when I modify the underlying array. I also have a custom view object that is bound to contents via an NSArrayController. In observeValueForKeyPath:of...