cocoa

IKImageView choppy?

I have an IKImageView, and I'm putting CGImages (That I make out of NSImages) onto it. However, a normal 200DPI 8.5/11 page takes like 3 seconds to come up, appearing in rectangles about 2inches (screen) on a side at a time. This is really annoying. Is there a way around this? Alternatively, is there a way to double buffer the view? To ...

In a CLI Cocoa application, how does one implement a event loop?

I have a Delegate class that handles responses from CLLocationManager and prints them via printf(). Is there some type of busy loop I can put in main() so that the program stays open and keeps CLLocationManager connected to Delegate happily processing events? #import <Foundation/Foundation.h> #import "Delegate.h" #import <CoreLocation/C...

Get current directory of a Finder window from a cocoa application

I'm trying to get a current directory of a finder window that is in focus from another cocoa application that is running in a background. I know that it can be done using an applescript like: tell application "Finder" try set dir to (the target of the front window) as alias on error set dir to startup disk end try end tell However...

[OS X Finder] Is there a way to programmatically connect to a remote server from Cocoa ?

Is there an Coca/obj-C API call to mimic the "Connect to Server" action in Finder? It's possible with Automater, so it seems like Finder has a hook somewhere. ...

Send sms from Cocoa application

I want to make a simple program to send SMS from osX. I know there's already something available on the web, but I want to code it by myself. I need to know if there's any useful API to write this with Cocoa or how to send AT commands to any discovered device. Thank you. ...

Draw a Custom View background

Hi, could you guys give me some hints about how to draw in a Custom View? ...

Problem with negative date on iPad and not on simulator

I'm working on an history application so I need to cope with date before and after JC. I'm trying to parse a string with the form "01/01/-200" but it returns a null date while it's working with "01/01/200". Here is my code : NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc]init] autorelease]; [dateFormatter setDateFormat:@"dd...

bool versus BOOL

Possible Duplicates: Objective-C : BOOL vs bool Is there any difference between BOOL and Boolean in Objective-C? I noticed from the autocomplete in XCode that there is a bool and a BOOL in Objective-C. Are these different? Why are there two different kinds of bool? Are they interchangeable? ...

conformance vs. inheritance in Cocoa/Objective-C classes

I noticed that Cocoa/Objective-C classes inherit and conform from other classes. I understand what inheritance is, but not conformance. What's the difference? Also, is a class like UIView a Cocoa class or an Objective-C class? ...

GCD blocks not updating NSCollectionView

I have a Cocoa app that listens for notification and posts updates to an NSMutableArray monitored by a NSCollectionView. The notifications arrive in large volumes so I was thinking to use a different queue to process them and update the array accordingly. Right now I am using addObserverForName:object:queue:usingBlock to register for no...

Write NSImage to file

Hi, I have an NSImage from NSImage *myImage = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[outputView bounds]]; and I need to save it to a file. I havent been able to find anything about saving NSImage in any format. Has anyone done this? Is it even possible? Thanks ...

CCSprite initializer causes crash with no exception or error

I am creating a custom CCSprite class to display a custom image and set its own position as well as handle other drawing tasks. Currently I have no other code running in the custom class but the initializer, which should set the image file and the position of the sprite. Here is my - (id)init method - (id)init { if (!(self = [sup...

why are these methods leaking NSDate objects?

First one: + (NSDate*)convertToUTC:(NSDate*)sourceDate { NSTimeZone* currentTimeZone = [NSTimeZone localTimeZone]; NSTimeZone* utcTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; NSInteger currentGMTOffset = [currentTimeZone secondsFromGMTForDate:sourceDate]; NSInteger gmtOffset = [utcTimeZone secondsFromGMTForD...

Duplicate symbol build error in XCode project

When I try to build my project I get the following error. ld: duplicate symbol .objc_class_name_GLFunView in /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFunView-7A51E8797CBB3D72.o and /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimul...

With...End With VB6 Statement like Statement in objective-c

Wondering if we have something like vb6 with..End With Statement in Objective-c? Example: With Object .a = "aaa"; .b = "bbb"; End With I know that there is something called blocks concept, but i am not sure whether it is available in 10.5 Leopard. Thanks ...

What is the Mac equivalent of AVAudioPlayer?

Hi, I am porting an iPhone app to Mac. On iPhone I use AVAudioPlayer for playing sounds, but it doesn't exist on Mac. What would be the Mac equivalent for playing audio (hopefully as simple as AVAudioPlayer so I can port my app easily)? Additionally, are there any open source libraries / samples / wrappers available for playing music ...

How to define and implement properties in protocol

Hi, I want to define one protocol with few properties and need to use those properties in another NSObject subclass. Please give me link or example code. I need that to work with 10.5. Thanks PLEASE CHECK THE FOLLOWING SAMPLE CODE @protocol MyProtocol @property (nonatomic, readonly) id someObject; @property (nonatomic, getter=is...

Cocoa custom view for NSMenuItem

Hi folks, I am developing a small app that display the active mounts in a menu in the NSStatusBar. So far it looks like this: I want to add an eject button to the right of each menu item (like the left bar in the Finder). I know that I have to create a custom view and set it with the setView: method. The problem is that I am very new...

Opening Images into OpenGL textures and saving textures as PNGs with Cocoa

Hello. There is a lot of conflicting information on how to open images with Cocoa for use with OpenGL. I want to open JPG and PNG files and save PNG files for my program which uses Cocoa on the Mac version. What is the best way to do these two tasks? Thank you. ...

Cocoa multiple user preferences on a single mac account?

Hi, I am currently in the planning phase for a scheduling and data tracking software. I want to let the primary user add password protected profiles to the program so that different people can use the program with access to different sets of the data and different capabilities. On of the things that I would like to add is the ability to ...