objective-c

On Mac OS X, how to create multi-touch event and send to another application?

I want to "simulate" a multi-touch event for another application, e.g., simulate a zoom-in gesture on iPhoto. I searched many sources but can't find an answer for that. It seems the most common way to sending an event to other application is with script bridge, getting a SBApplication and then send an AppleEvent. But it seems the genera...

iPad keyboard will not dismiss if navigation controller presentation style is "form sheet".

UPDATE: This is apparently "works as intended" classed by Apple. See accepted answer below for details. Update: this question is about a behavior discovered in the iPad keyboard, where it refuses to be dismissed if shown in a modal dialog with a navigation controller. Basically, if I present the navigation controller with the followi...

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 ...

Is Clang Static Analyzer enough?

Hi guys, I'm new to iphone and objective-c development and want to ask if Clang Static Analyzer is enough for getting rid of memory leaks? I personally found the xcode "Leaks" tool rather difficult to use, besides I've seen some articles, where it reads that it will always show memory leaks, even if there are no any real leaks. If I don...

C++ class declaration in objective-c header

I want to declare a class c++ style in a objective-c header, but i get an error "error: expected '=', ',', ';', 'asm' or '__ attribute __' before 'CPPClass'" Here is code from the .h file. class CPPClass; @interface OBJCClass : NSObject { CPPClass* m_pCPPObject; } @end if i implement it objective-c style @class CPPClass...

Page flip transition

Hi, I was wondering how to turn this code into a page transition. I want to switch Xibs with this page flipping affect. Thanks! .h: #import <UIKit/UIKit.h> #import <QuartzCore/QuartzCore.h> @interface PageOpenAnimationTutorialViewController : UIViewController { IBOutlet UIButton *openPageButton; IBOutlet UIImageView *pa...

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...

CoreData doesn't fetch any rows

I have a very basic CoreData backed iPhone application. After I forced the app to generate the sqlite file, I took it and prepopulated it with one record to test loading it into tableview. I've hit a snag, though, because CoreData doesn't seem to be finding the row in the table. - (NSInteger)numberOfSectionsInTableView:(UITableView *)t...

Can a sound be played as soon as a page is loaded?

I would like to play a sound as soon as a page dispalyed. I am currently playing sounds using a IBAction doSound after a button is pressed. This works as intended. But, I am also wanting to play music or a short verbal instruction as soon as the page is displayed. I would like to use the same IBAction since it is already set up, but was ...

How can I add a UIGestureRecognizer to a UITableViewCell subview?

imgView is a UIImageView that is added as a subview to a custom UITableViewCell class. The action isn't being called when the image is tapped. [imgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openMedia:)]]; ...

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...

IPhone Facebook Api Friends.getLists returns nothing

In my application I try to get list of friends using Facebook Api method Friends.getLists. I have to use this Api since I use another methods from this Api in my App and they works fine. So I cannot use others methods. This code returns just nothing: [[FBRequest requestWithSession: _facebookSession delegate: self] call: @"facebook.Frie...

Is it possible to hide the navigationcontroller?

Hi, I have a iphone apps with a navigation controller, dans I want to push a view but in this view the navigationController must be hidden, or if it's not possible, is it possible to only hide de left button, so the user can't go back. thanks, alex ...

IPhone Memory management and CATransition

Having some basic issues with managing the total memory from adding and removeing a uiviewcontroller - but only when i add an animation to it using CAtransition. I set up a simple scenario below of the situation: I have a basic view controller that I init/alloc called IVC, and I add to the current uiController: IN the header file it ...

Get iPhone to Vibrate.

I've been trying to make the iPhone Vibrate using this code: AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); But is not working, could it be because I am playing sound at the same time as calling this? ...

Run a method after init in cocos2d

I have a loading screen that I initialise with a label to display the loading progression. I want to call my DataManager AFTER initialising the loading screen, and then call a method to switch scenes. Here is my code: -(id) init { if((self=[super init])) { loadingLabel = .... [self addChild:loadingLabel]; /***** This is...

Using one setter for all model iVars

I have a series of models for my application. Across all these models there are (will be) some 200 or 300 instance variables. The application stores its persistent data on a web-based server (MySQL - but I guess that part doesn't matter). Whenever a model iVar is updated I need to make a call to the server to update the appropriate value...

UIActionSheet Like Button.

How could I create a button that looks like the button in a UIActionSheet, as apple have done sometimes in their apps. ...

[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. ...

Build settings in xCode that support iOS 3.0 - 4.0 and iPhone 3g - 4

I want to build an app that is compatible with iPod touches, iPhone 3g, iPhone 4, iOs3.0, etc... Everytime I build on a 3GS, I use these build settings Architectures: Standard (armv6 armv7) Build Active Architecture Only (Unchecked) Valid architectures (armv6 armv7) And I select armv7 as the active architecture before I build. However f...