cocoa

Draggable Elements for Token Field like Mac clock format panel

I need to be able to make a token field with draggable elements like the Mac clock format panel (see the following image). Thanks so much, Alex. ...

Open chat in Cocoa XMPPFramework

How to open new chat on XMPPFramework? Something like this example: XMPPConnection.DEBUG_ENABLED = true; ConnectionConfiguration config = new ConnectionConfiguration("server.com", 5222); config.setCompressionEnabled(false); config.setSecurityMode(ConnectionConfiguration.SecurityMode.valueOf("disabled")); config.setSASL...

Animating a CALayer with a series of repeating images

I have created CALayer objects and am able to animate their movement around the screen. However, now I want to animate them to change through a set of images in a loop to create an animation (like an animated gif) I'm fairly new to programming and very new to cocoa so code examples welcomed. I have 15 png images. --Charliehorse EDI...

How to sort NSMutableArray of NSMutableDictionary?

I have NSMutableArray of NSMutableDictionary(NSString objects). One of NSString object is actually a date, and i need to sort NSMutableArray based on that date and I don't want it to sort dates as strings. How can i make it? ...

Strange behaviour of NSScanner on simple whitespace removal

I'm trying to replace all multiple whitespace in some text with a single space. This should be a very simple task, however for some reason it's returning a different result than expected. I've read the docs on the NSScanner and it seems like it's not working properly! NSScanner *scanner = [[NSScanner alloc] initWithString:@"This is ...

Webview blank but content is there

I am having trouble displaying a webview. I have a webview inside a custom view. I load this custom view as a subview of the window, and then have an object controller linking a text field to the content of the web view. Once a page is loaded, it loads all the content, but it is visually white. You can click on links. If you go to a Yout...

Wanting a simple overview on how to connect to a SQLite database in Cocoa/Objective-C

Hi, everyone. I've been experimenting with Cocoa and Objective-C programming on the Mac for a few months now, and I am wanting to start developing applications that manage large amounts of data. The trouble is, I'm not really sure where to start with databases. I have a good background in Java programming with SQLite. I've read a bit a...

How to manage memory load of static, lazily loaded dictionaries and arrays.

Generally, I use static arrays and dictionaries for containing lookup tables in my classes. However, with the number of classes creeping quickly into the hundreds, I'm hesitant to continue using this pattern. Even if these static collections are initialized lazily, I've essentially got a bounded memory leak going on as someone uses my ...

Performance issue finding weekdays over a given period

I have some methods that return the number of weekdays between two given dates. Since calling these methods become very expensive to call when the two dates lie years apart, I'm wondering how these methods could be refactored in a more efficient way. The returned result is correct but I feel that the iphone processor is struggling to ke...

Display NSWindow as Subview of NSView...

I have an NSWindow that I want to display as part of another window. It has to be an NSWindow; I don't want to change it to an NSView or anything... I just don't because it involves accessing foreign nib files and the such. How should I accomplish this if possible? I was thinking along the lines of grabbing the view of the NSWindow and ...

Creating a "permanent" Cocoa object

I have an object factory that hands out instances of a few "constant," immutable objects. I'd like these objects to be protected against bad memory management by clients. This is how I've overridden the class's key methods. Am I missing anything (code or other considerations)? - (id)retain { return self; } - (NSUInteger)retainCount...

Array of NSButton

I wonder if I can do something like IBOutlet NSButton * aButton[100]; It turns out that aButton cannot be seen in the interface builder. My app has lots of buttons and I want to see if there are way I can use looping to iterate the state of all buttons. ...

How to convert Unicode strings (\u00e2, etc) into NSString for display?

I am trying to support arbitrary unicode from a variety of international users. They have already put a bunch of data into sqlite databases on their iPhones, and now I want to capture the data into a database, then send it back to their device. Right now I am using a php page that is sending data back to from an internet mysql database. ...

Is it possible to invoke NSDictionary's valueForKeyPath: when a key contains periods?

I'm trying to get the value of the repeatInterval key in the com.apple.scheduler plist. I'd like to just use NSDictionary's valueForKeyPath: method like so: CFPropertyListRef value; value = CFPreferencesCopyValue(CFSTR("AbsoluteSchedule"), CFSTR("com.apple.scheduler"), kCFPre...

why can't I set a new instance's delegate as self?

I have a uipickerview, which appears with an ActionSheet. All this is in a class "MultiPicker". I create a new instance from "FirstViewController" this way: multiPicker *multiPic = [[multiPicker alloc]init]; multiPic.delegate = self; [multiPic action:aRunIndex]; And inside "multiPicker", in "action:" UIActionSheet *actionSheet ...

How can I know which button I clicked to start an action inside the program?

I have 3 buttons which call the same function. I want to know inside the function which button called it. Is it possible to know it? ...

Is it possible to hide the dock icon programmatically

Is it possible to hide dock icon programmatically on demand. I know one way by which defining property "Application is agent (UIElement)" in plist we make the cocoa app as user agent. But this result in hiding the dock icon permanently. I am looking for a way where i can control visibility of dock icon. Any idea ? ...

Find the Last Accessed Date of a File in Cocoa

Is it possible to get file/folder last accessed date in mac using cocoa? struct stat output; //int ret = stat([[[openPanel filenames] lastObject] UTF8String], &output); int ret = stat([[[openPanel filenames] lastObject] fileSystemRepresentation], &output); // error handling omitted for this example struct timespec ac...

Does Objective-C have a Standard Library?

Most somewhat modern programming languages have a standard library? It is my impression is that there isn't a decent sized standard library for Obj-C , rather that it relies mostly/all on Cocoa and that (plus people not wanting to use GNUstep) is why Obj-C is only used on macs)? Is this true/to what extent? Are there any standard obj-c...

Add new language to existing Xcode project localization

Hey guys, I'm working on an existing Xcode 3.2.2 Universal iPhone OS project which is already localized for 4 languages (EN, IT, DE and FR). We are now adding a new language (JA) into this project. Each existing .lproj folder (en.lproj, it.lproj, de.lproj and fr.lproj) has almost 60 files - including PNGs, HTMLs and the Localizable.str...