objective-c

CGPostMouseEvent replacement on Snow Leopard

I've been using CGPostMouseEvent() for performing mouse clicks since mac os 10.4. While working on my code and trying to make it 100% compatible with Snow Leopard, XCode spit a warning saying that CGPostMouseEvent() is deprecated. While this doesn't scare me, I'd like to know what replaces CGPostMouseEvent(). This is how I use it: CGPo...

Performing a double click using CGEventCreateMouseEvent()

I'm using the following code to simulate a click of the mouse: void PostMouseEvent(CGMouseButton button, CGEventType type, const CGPoint point) { CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, point, button); CGEventSetType(theEvent, type); CGEventPost(kCGHIDEventTap, theEvent); CFRelease(theEvent); } void LeftClick(con...

Making a NSPopUpButton display all my iCal Calandars.

I have a NSPopUpButton and I want the Menu Items in it to display the users iCal calenders. From there I want it depending on which is selected to change this code. CalCalendar *calendar = [[store calendars] objectAtIndex:0]; The code defines which iCal calender to sync to, at the moment it's the default calender, however I want to ch...

Making a Method happen every 60 seconds when the App is running.

I'm wanting to make one of my methods to run every 60 seconds when my App is running, how would I do that? ...

Triggering a method when a row in a Table View is edited.

Is there a way to trigger a method (or a method its self which is triggered) when a Row in a is edited, more specifically, when text in a row is edited or when something changes in the Table View (e.g Row Added/Removed)? ...

Dimming NSWindow and layer NSView on top

Is there any way I could dim my NSWindow (basically putting a black transparent layer over top of it that you cannot click through) and then layer a custom NSView on top? ...

Xcode editor default to -(void) instead of -(voidPtr)?

In Xcode (3.2 on Snow Leopard) when I start to type out a function such as -(void)myFunctionName { } When I first start typing the code hint is -(voidPtr What is the difference between void and voidPtr? I assume that voidPtr is a pointer of some kind, what cases call for its use? Do I want to be using voidPtr instead of void? Ca...

NSCollectionView in 10.6/Xcode 3.2

Hey there, in Xcode 3.1.2 I used to load the nib of the NSCollectionViewItem in my subclass of NSCollectionViewItem like this: -(id)copyWithZone:(NSZone *)zone { id result = [super copyWithZone:zone]; [NSBundle loadNibNamed:@"PersonView" owner:result]; return result; } In Xcode 3.2 under 10.6 the same method doesn't ...

Arbitrary objects to handle actions?

Hi, My question may be a bit stupid, but why can't any object instantiated in IB handle, say, button click? I mean I'm able to add my own object to a xib, and link outlets to cotrols and control actions to object's method, but once I press the button everything just crashes (uknown selector). Do you guys have a hint around that? EDIT:...

Geo-tagging a photo on the iPhone?

Hi everyone. A link or a bit of code would be much appreciated! I have an app that lets users take photos. Here's the code I use to create the jpeg file. How can I add a geo-tag to the photo's EXIF data, assuming the parameter info has a lat and lon? - (void) saveImage:(NSDictionary*) info { NSFileManager *fileManager = [NSFileMan...

What's wrong with this selector declaration?

I expect this to work based on the docs here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocSelectors.html SEL sel = @selector(loadMapType:[ms uniqueTilecacheKey]); "error: expected ')' before '[' token" ...

Passing Around a Selector and Then Specifying Parameters

I have a function that creates a UIView with a bunch of UIButtons. Each button calls a function with a string for a parameter. So, in my function I do something like: [button addTarget: [multiRadio objectAtIndex:0] action: NSSelectorFromString([multiRadio objectAtIndex:1]) forControlEvents:UIControlEventTouchUpInside]; H...

XCode Preprocessor Macro for Configuration?

I want my XCode Objective-C project to be able to detect which configuration it is being built with. How can I achieve this? Thanks in advance. ...

Best compiled language for Mac OS X and Linux compatibility

We need to write some software that will compile and run on both an Mac OS X server and Ubuntu. We would love to use Objective-C with all of its Cocoa goodness, however the GNUstep implementations of the parts we are using are broken (in the latest Ubuntu package anyway.) In light of this should we use C++ (I would really rather not), C...

how to sharp/blur an uiimage in iphone?

i have a view with uiimageview and an UIimage set to it.how do i make image sharp or blur using coregraphics? ...

Can you programatically look up a word in the Mac OS's built-in dictionary?

I'd like to have a program of mine retrieve a definition of a word. Is there a way to access the built-in dictionary using Objective C? (i.e. the one that Dictionary.app and command-control-D use) Thanks! ...

I want to switch button image on click.

I want to change the image of button on click. click once 1 image should be set on he button and when again clicked the 2nd image should be there and these images should switch on click. ...

Calling a function from another UIViewController

Hi guys, I'm a beginner programmmer, this is for xcode - iPhone. although i made alot of my iPhone app but i seem to lack some understanding of how a simple communication might work. Specially when I've got 2 ViewControllers. And I wana call one function of a ViewController from another ViewController. Both are under a tabbarControlle...

how to get all images from imagelibrary in iphone?

i want to get all images from imagelibrary either using imagepickercontroller or any other way(like programatically).... ...

How can an Objective-C method refer to the object that invoked it?

This is so simple it's driving me crazy that I can't find an answer. How can a method refer to the instance that invoked it? Example: in some method of class alpha, I have "[bravo charley]" I want to have the charley method do "[alpha-instance delta];" with the particular instance of alpha that did the "[bravo charley]". But charley d...