objective-c

Send An Action Cocoa - IBAction

I'd like to send an action to another object using cocoa. Ideally i would also like it to appear in the Interface builder. I've tried the apple documentation, but there is something i'm missing. Adding the following, the interface building only shows the action as a received one. - (IBAction)setTarget:(id)anObject; - (IBAction)setActio...

How do I escape a Unicode character in my source code?

I feel incredibly stupid for asking this, but the documentation and Google are giving me no love at all. I have a Unicode character I want to insert into a string literal in the source code of my iPhone app. I know its hex value. What is the proper escape sequence to use? And for that matter, what obvious source of information am I o...

How can I solve this Problem with bidirectional dependencies in Objective-C classes?

Okay, this might be a very silly beginner question, but: I've got an ClassA, which will create an child object from ClassB and assign that to an instance variable. In detail: ClassA will alloc and init ClassB in the designated initializer, and assign that to the childObject instance variable. It's header looks like this: #import <Found...

How do you implement the Method makeKeyAndOrderFront: ?

I am making a new window open and would like to implement the method makeKeyAndOrderFront: for the window, i was wondering what code i would need to enter to do this. Here is some of the code I've already got to open the window: File 1 (The First Controller) #import "PreferenceController.h" @implementation PreferenceController - (i...

Why is App window only opening once and then not opening again?

I am creating a app from a tutorial in a book, but I noticed a problem, when the preference window i created is opened and then closed it won't open again, how can i fix this? Thanks. EDIT: I saw another post about this but was still un-answered, so i was wondering if you could answer this for me. EDIT: I am talking about a panel (use...

Objective-C/Cocoa: Properly loading UIViews.

Suppose I have created a UIView, MyView, in Interface Builder, and I have hooked it up (set its File's Owner) to my UIViewController class, MyViewController. Now, I would like to present view. It's just another view, so I don't want to present it as a modal view. How do I go about displaying it? Should I add it as a subview of my win...

Is there any way to get the "Me" card from iPhone Address Book API?

So I'm stumped on this one. In Mac OS X there is an easy way to get the "Me" card (the owner of the Mac/account) from the built-in address book API. Has anyone found a way to find out which contact (if it exists) belongs to the owner of the iPhone? ...

What's the difference between [NSNull null] and nil?

Here's a context where I have seen that: NSMutableArray *controllers = [[NSMutableArray alloc] init]; for (unsigned i = 0; i < kNumberOfPages; i++) { [controllers addObject:[NSNull null]]; } why not nil in that place? ...

iPhone - int to NSData?

I'm making an iPhone app where I want to save state of the Application. This includes an int property which I'm persisting to a file on its own. I have it written and working, but I know the way I did it was a bit hacky, converting the int to a String and then NSData. Can anybody suggest a better way? int someInt = 1; NSString *aString ...

Where does a Datasource object belong to? Controller or Model?

I'm implementing a datasource object for an UIScrollView. Is that part of the Controller, or part of the Model? I think Controller, but not sure. It delivers the data. But the data could be in sqlite3, files, from the net. So actually I would say it's not from the Data part, since it should be flexible to from where the data comes. What ...

Why is my NSInteger changing from 12345 to -1758050543 when I pass it as an argument in an Obj-C method call?

Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@"AlertTableView: selecting row at index %d", index); [self.caller didSelectRowAtIndex:index withContext:self.context]; } In self.caller: - (void)didSelectRowAtIndex:(NS...

When do you make an underscore in front of an instance variable?

I've seen this at Apple, inside UIPickerView.h: id<UIPickerViewDataSource> _dataSource; why's that underscore there? Does it have a special meaning? A Convention I must know about? ...

mac osx speech to text api How-to?

Hi Gurus, I have a program that receives an audio (mono) stream of bits from tcp/ip. I am wondering if the speech(speech-recognition) api in mac osx would be able to do a speech-to-text transform for me. (I don't mind saving the audio into .wav first and read it as oppose to do the transform on the fly) I have read the official docs on...

What does this line of code mean?

Hey, What does this line of code mean? I do not understand it - (IBAction)edit { self.editingViewController.movie = self.movie; // I dont understand this line [self presentModalViewController:self.editingViewController animated:YES]; } And what about this? - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:ani...

[iPhone] navigation controller madness

Greetings. I've got a nav-bar application that's misbehaving. I've got two buttons, one that shows all results from my database and another that shows a subset of my database. Of course, each button has its own action method. Both of these methods instantiate a view controller object of the same class. If I start the app and only click ...

2d arrays of ints in objective-c

I am working with C style 2d arrays of integers. This is fine in my main class file, and I can pass my arrays by reference to other classes. I have run into issues when I try to retrieve a pointer to the arrays and work with that. My question is: rather than using C style 2d arrays, is there a better way to do it? maybe a Cocoa class I...

ICMP and the iPhone SDK

I'm looking to implement a Ping class in Cocoa-Touch. From the googling I have done and old c code I have looked at, it seems using the ICMP protocol is the best way to go. I guess my question is, is ICMP supported in the iPhone SDK, and if not, is there anything in the CoreFoundation Network classes I could use instead? I have had a lo...

How do I add a UIButton or UISwitch in tableView:viewForFooterInSection

Hello. I'm trying to understand how to add a label with a UISwitch or other controller to a footer (or header) in a sectioned tableView. Any help would be greatly appreciated. Thank you in advance! ...

how i get ringing mode of the iphone?

I want to get the current mode of the iPhone that is, the iPhone is on silent mode or in vibrate mode. ...

iPhone how to suppress phone dialer screen

Hi, I am writing an application which dials a phone number using the "tel" protocol. While dialing the standard iPhone dialer screen pops up. Is there any means by which this screen can be suppressed? Or make this screen device orientation aware? ...