objective-c

Simulating keyboard tap

Is there a way to programmatically tap a key, just as a user would so the key pop up animation takes place? ...

Convert coordinates between parent/child UIView after CGAffineTransform

Hi Before I go into doing everything by hand I would like to ask if there is some help to get from the framework. I have a UIView that holds another UIView with a map. The parent UIView holds some legends for the map. Initially I define some coordinates in the map view. e.g. (100, 40), and place a piece of graphics there in the parent ...

viewController, display methods called?

I am just trying to work out how the viewController is working in a simple iPhone app. My question is I am trying to see when the functions below get called, I have put NSLog commands in there to print to the console, but I don't see any of the below printing either when running or exiting my app, do they get called, should I see anythin...

Is it possible to catch touch events on the iPhone using pure C?

In iPhone applications you can catch touch events through the UIEvent and its associated set of UITouch instances, but this happens at Objective-C level. What I am looking for is a way to get this information at a lower level, in C code (no Objective-C involved), and in particular I'm thinking of Core Foundation data structures, similarl...

iPhone Delegates - How to use them correctly

I have 2 or 3 views in my iPhone application where I have various pieces of functionality that use delegates. In all cases the delegates are assigned to "self", responding specifically to that view's actions and interacting with instance variables. However, if I do something that takes a bit of time with a delegate, and leave the view, ...

iPhone delegate & controller dealloc?

I have been playing with a simple iphone app and decided to put an NSLog statement in the deallocs of both the controller and the delegate but neither of these print out to the Xcode console? // APPLICATION DELEGATE #import "iPhone_buttonFunAppDelegate.h" #import "iPhone_buttonFunViewController.h" @implementation iPhone_buttonFunAppDe...

Comparing strings in IF statements: unrecognised selector sent to instance...

in my code, I need to compare two strings to see if they are equal. if they are it needs to preform a function. one of the strings is just a @"someString", the other is part of an object. if ([[[mine metal] stringValue] isEqualToString:@"Gold"]) { //some function } however there are some complications when I do this. first, it gives ...

Obj-c delegate model - in Java?

Hi, I'm writing a small chat program in Java. I got some classes whose objects have to keep track of one another (e.g. the connection listener needs to update the GUI when a new message comes in, just like the GUI needs to write to the connection's writer, when the user wants to send a message). In Cocoa on Mac OS X I'd write & impleme...

How to get double value from dictionary?

I'm trying to get a double value from a dictionary. How can I accomplish this in objective-c? Thanks ...

Objective-C-Cocoa book recommendation for an AS3 developer.

Hi Just looking for more recommendations for great Ojective-C-Cocoa books. My ideal book would be one with actual hands-on walk thru examples increasing in complexity and doesn't spend unnecessary time on basic OOP. Trying to leverage what knowledge I DO have in Actionscript 3. (or maybe its all about unlearning?) ...

General Objective-C Class method question

I have an iPhone application which has some methods to gather information from the web and which then creates an object, which holds this information as properties (lets say I'll get objects of type x). Since I might need those kind of objects from various points within the application, I put the method to create one instance of the obje...

Setting an NSURL with %@ making value equal to %@ instead of inserting %@

Hi, I'm using ASIHTTP and trying to perform a GET request for a site: NSURL *url = [[NSURL URLWithString:@"/verifyuser.aspx?user=%@" relativeToURL:@"http://domain.com"],userName retain]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setTemporaryFileDownloadPath:@"myfile2.txt"]; [request setDownloadDesti...

Showing Random Words From Plist Dictionary - Memory Leak?

Hi. I am new to iphone development. I am "old School" - I was tought to use Procedures etc. when programming. Everything is object oriented these days but my style is still as its always been. Please bear that in mind. My project is tiny and really just a proof of concept. The program below works on a timer - every 30 seconds it will r...

How to pull a string out from NSUserDefaults

Alright, I have my code, and I believe I have narrowed down the crashing bug to one section. Upon the view loading, my code loads the NSUserDefaults and pulls the string out of them. It then works with teh string. The problem is, I'm not sure how to pull the string out. Here is the relative code: NSUserDefaults *prefs = [NSUserDefau...

How to get the name and value of attributes from xml when using libxml2 sax parser?

I got stuck on trying to detect the pair of name and value of the attributes in some general xmls by using libxml2 for parsing the api on iPhone application. For my project, the parsing speed is really important, so I decided to use libxml2 itself instead of using NSXMLParser. Now, as referring to XMLPerformance that is a sample of iPho...

return a copy or a mutable object

Which variant is more correctly? //first variant - (NSArray*) someArray { NSMutableArray* mutArr = [[NSMutableArray alloc] init]; //...some operations with mutArr NSArray* retArray = [mutArr copy]; [mutArr release]; //remove mutArr return [retArray autorelease]; } //second variant - (NSArra...

How can I change the audio output device in Objective-C?

I'm building a simple Cocoa app and I want to direct the audio output to a specific device, instead of the system selected one. I know some apps, like Skype, let you select where to send the output to. How do they do this? I tried the MTCoreAudio framework but I can't even compile my app (or their AudioMonitor demo) with it included and...

Design strategy advice for defining machine system functionality

This question relates to project design. The project takes an electrical system and defines it function programatically. Now that I'm knee-deep in defining the system, I'm incorporating a significant amount of interaction which causes the system to configure itself appropriately. Example: the system opens and closes electrical contact...

Very basic Objective-C/C Problem

Hi! Here's my code: #import <Foundation/Foundation.h> void PrintPathInfo() { const char *path = [@"~" fileSystemRepresentation]; NSLog(@"My home folder is at '%@'", path); } int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; PrintPathInfo(); [pool drain]; ...

release and autorelease? what is the difference?

Hi I still have some unclear understand about release and autorelease. What are the difference between both of them? I have this code. For facebook connection. I crash it sometimes when I go to Facebook login, I doubting maybe it is because I don't release the object nicely.? Thanks for any helps if (_session.isConnected) { [_...