objective-c

Generate classes from XML Schema

Coming from a .NET background where you can easily generate an object model from an XML schema (through, for example xsd.exe) I wanted to know if there is a similar facility for generating Objective-C/NSObject objects. Thanks! ...

Subclass of NSObject as target in addEventListener statement

When setting the method of a button call or adding an event listener in objective-c, one normally sets the target to self. However I have a subclass of NSObject named CALLS, separate from the main file. This subclass has a void called METHOD_NAME which should be executed. THe first question is would the void be +(void)METHOD_NAME or ...

EXC_BAD_ACCESS while removing MKAnnotations

I am writing an iPhone app where the user is supposed to be able to turn on and turn off all the pins on the map. To put all the pins on the map I use: -(void) putAllPins { for (id key in myDictionary) { //A NSDictionary NSArray *data = [myDictionary objectForKey:key]; [self putPin: data]; } isShowingAllPins ...

Cocoa, NSProxy, How to take over a method in an object?

I need to replace a method in an object with my own implementation. For example, Person *p; // some object NSMutableArray *array = [NSMutableArray array]; [array addObject: p]; How can I replace addObject with a method of my own? In other words, is there a way to replace the implementation of addObject: of a SPECIFIC object with ano...

AVFoundation question - iPhone SDK

What's the best way to grab a succession of images from the camera using the AV Foundation framework? I am only interested in what an iPhone 3G can support. I haven't been able to find any information on which classes are not supported on the iPhone 3G (without video capability). Has anyone had any experience with this? Many thanks, Br...

Problem zooming into UIImageView

I am following Apple's ScrollSuite example, however pinch to zoom is not working. I am not sure whats wrong: // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; // set up main scroll view imageScrollView = [[UIScrollView alloc] initWithFram...

If I want to make a new instance of an object in a function whose pointer is passed by reference in it.

- (void)createAString:(NSString **)str { *str = [NSString stringWithString:@"Hi all!"]; [*str autorelease]; // ???? is this right ? } How should I use release or autorelease ? I don't want to release outside of the function of course :) ... NSString *createStr; [self createAString:&createStr]; NSLog(@"%@", createStr); ...

Assigned value is garbage or undefined logic error in XCode

I am updating our iPhone app to iOs4 and I ran into an issue "Pass-by-argument in function call is undefined" in the code for (i = 0; i < self.numberOfSegments; i++) { [self setWidth:round(width[i]) forSegmentAtIndex:i]; } Which is fair enough, width[i] hasn't been initialized. Updating the code (below) however gives me this...

Using an object other than File's Owner for IBOutlets and IBActions

I have a currently working program that has IBOutlet and IBAction connections from the interface to File's Owner. I made a new class, and added that to the document window in Interface Builder. Then I moved everything from the File Owner class files to the new class files. I removed the old connections and reconnected everything to the n...

How to autorotate UIScrollView and UIImagewView programatically?

I have a UIScrollView and a UIImageView which I have created programatically without interface builder. How can I make sure both auto-rotate in horizontal orientation? ...

Objective-c regex to check phone number

How to validate a phone number (NSString *) in objective-c? Rules: minimum 7 digits maximum 10 digits the first digit must be 2, 3, 5, 6, 8 or 9 Thanks ...

Table data in SQLite database shows fine in Simulator but does not appear when deployed to device.

Table data in SQLite database shows fine in Simulator but does not appear when deployed to device. Would appreciate if anyone can help. ...

Formatting tips for Objective-C nested blocks

I don't mean to start a code formatting holy war here, but I'm wondering if anyone has any advice on how to best format nested blocks in Objective-C. Here's some code I wrote today: [UIView animateWithDuration:1.0 animations:^{ self.alpha = 0.5; } completion:^(BOOL finished){ [UIView animateWithDuration...

error message: expected ')' before 'NSRect'

I am having a strange error in the program. However, I do not find any syntax error. The error is: expected ')' before 'NSRect'. How can I get rid of it? I get those errors in line 1 and 2. I also tried importing Foundation/NSGraphics.h. It did not work. #import <Foundation/Foundation.h> @interface MyQuartzView : NSObject { } - (id)i...

Objective c memory leak.

Here are two methods that return a dictionary of my custom four-propery objects. They make arrays of strings, floats and BOOLs to put in the Chemical objects, then build a dictionary from the arrays. I'm new enough to the whole memory management game that I'm not always sure when I own something and when to release it. I'm making all ...

Circumvent screenshot for iOS 4

I would like to clear a view before an application is switched away from, to change the launch image so that the next time the app is entered it will not display some insecure data. iOS 4 provides applicationDidEnterBackground and applicationWillResignActive...however, neither of these seem to be able to prevent the screenshot from bein...

NSString's superclasses go on forever.

I've got a method that when put a breakpoint in it and hover over a string, says it's out of scope and you can drill down into the NSString object for what seems like forever. I've tried to put a screen shot... hope it shows up. I think I have some serious memory management problems... http://web.me.com/gazelips/Site/Blank_files/scree...

Sms service in iphone

does iphone 4.0 support sms service?? ...

Adding Sections to a UITableView.

How would I have a button that would add a Section to a UITableView? I know how to do it without adding sections and just having a list but how would you allow the user to add section as well as cells/rows. ...

How do I hide the textfield cursor on the iPhone when keyboard is active.

we are trying this for password settings,so that cursor should not be visible to user. ...