objective-c

Recognizing multiple string values in a single action ...

Thanks again for the help. I have a simple action that checks the stringValue of a textField, and if it matches - a status message prints in a second textField: if (textField.stringValue == (@"Whatever" )){ [outputDisplay setStringValue:@"Success"]; My question is how do I implement multiple input stringValue options in this met...

Putting a 'terminal' in my application?

Are there any frameworks for say, putting a display like in Terminal.app in MY app, and then displaying text on it like usual output to STDOUT? Complete with scrollback and etc.? ...

Indexing an alphabetically sorted list

I have an array with a list of objects sorted alphabetically ignoring the letters case (used a lowerCaseString method) and I need to sort it into an array of arrays one for each letter +1 for non alpha characters. A simple way of doing it would be to loop through the source array with a giant 27 stack deep if else if else if else.... Ne...

Get correct bounds for navigationItem.titleView layoutSubviews

I have a subclass of UIView that I've added to as the titleView of a navigationItem using the following line of code: self.navigationItem.titleView = tempview; Easy enough. That works fine. My problem is that this navigationItem sometimes has the rightBarButton updated (sometimes there is no button, sometimes there is one standard siz...

Core Data Ordered Join Table Efficiencies

I have a complex core data mapping in my app, simplified to the relevant pats to this question here in this image: My question is how to get sorted Foo's efficiently. Let's say that in one of my views, I have a sectioned table with every foo in it. The sections are the categories. Each section of foo (in a category) has an ordering...

pass specific enum value to method in objective-c

Altough I already know it's not possible, as my understanding how programming works, I would like to have a confirmation of this. I have an enum typedef enum { enum_first=1, enum_second=2 } myenum I wanted to do overloading of method, this syntax is obviously wrong, but it gives the idea: -(id)myenumTest:(myenum.enum_first)value {.....

Where is the leak here??

-(IBAction)startGameButtonClicked:(id)sender{ //gameViewController = NULL; //[gameViewController release]; //[gameViewController dealloc]; if(!gameViewController){ gameViewController = [[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil]; } appDelegate.ScoreID=0; [gameViewCo...

Objective-C iPhone - YouTubePlugIn.webplugin/YouTubePlugIn warning

Hi, I'm trying to play a YouTube video within an iPhone app using the technique in this URL http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application The technique works fine and the video plays fine, except that I'm getting this warning. warning: Unable to read symbols for "/Developer/Platforms/iPhon...

How to represent object from array?

I have the following array, which was retrieved from JSON results: <NSCFArray 0x196e3e0>( { NameID = 3; Name = test1; }, { NameID = 6; Name = test2; } ) I'd like to go through each object via a tableview and assign its values to labels in a custom tableview cell. How do I access NameID and Name on each iteration? D...

Objective-C iPhone - UIImagePickerController error

Hi, I'm doing something with UIImagePickerController. It works fine and the Picture browser does open, however, I get this message. "Failed to save the videos metadata to the filesystem. Maybe the information did not conform to a plist." What could be causing that? That is caused by this line [self presentModalViewController:self.imgP...

MVC Pattern: Where does formatting/processing type work belong? (Objective-C)

As my Cocoa skills gradually improve I'm trying not to abuse the MVC as I did early on when I'd find myself backed into a hole built by my previous assumptions. I don't have anyone here to bounce this off of so hoping one of you can help... I have a custom Model class that has numerous & varied properties (NSString, NSDate, NSNumber, et...

-(void)dealloc = How?

Hello ! every one. I have a little query regarding the memory management. Let's begin with an example. Assume we have a class as follows. @interface myClass : NSObject { NSString *xyz; } @end Now, see the implementation. @interface myClass : NSObject { NSString *xyz; } @end @implementation myClass -(void)abc{ // xyz a...

Remembering the Selection of a NSPopUpButton for the next launch.

I am trying to get my app to remember the selection of an NSPopUpButton for the next time the App is launched. I tried binding the Selection Index to a NSUserDefaultsController but it has no effect, It doesn't remember the selection for the next launch. What do I need to do? ...

How to Duplicate an AppleScript function in Objective-C?

This AppleScript code gives the name of files that have been dropped onto the script. How do I do the same in an Objective-C app? Would an application written in Objective-C be able to boot the JAR file using the file name as an argument to JAR? on open of theFiles -- Executed when files are dropped on the script set fileCount to (...

Using textField:shouldChangeCharactersInRange:; how do I get the text including the current typed character?

//find below, the code example & associated result - (BOOL) textField: (UITextField *)theTextField shouldChangeCharactersInRange: (NSRange)range replacementString: (NSString *)string { if (theTextField == textField1){ [textField2 setText:[textField1 text]]; } } This code produces... textField2 is "12", when textF...

How can I do accurate decimal number arithmetic since using floats is not reliable?

How can I do accurate decimal number arithmetic since using floats is not reliable? I still want to return the answer to a textField. ...

Xcode completion doesn't recognize the type of my variable

I'm creating an object with: NSMenu *appMainMenu = [[NSMenu alloc] initWithTitle:@"MyApp"]; (Ignore the fact I'm creating this menu programmatically and not using a Nib File. I understand the disadvantages of doing so) The menu appears correctly in the menubar. However, when I try to call any instance method such as: [appMainMenu...

error building the first program from Hillegass's book: Cocoa Programming for Mac OS X

I'm trying to build the first program in Aaron Hillegass's book: Cocoa(R) Programming for Mac(R) OS X (3rd Edition). The problem I'm having is that I can't my Interface object to "spawn" for lack of a better term unless I build and run the program. Herein lies the problem. While the program is running I can't connect the code to the int...

Why some method declarations in the UITableViewDataSource protocol are preceded by "tableView:(UITableView *)tableview?

The formulation of the question may be confusing. I do understand why it is useful for a method like cellForRowAtIndexPath to receive a pointer the relevant UITableView. What I don't understand is more Objective-C wise: I would like to put a name on is this special way of declaring methods? Like if an object (e.g. UITableView) that hav...

Getting Memory Leak in textFields.

Hi Guys, Here Im Getting memory leak at eventTextField.keyboardAppearance = UIKeyboardAppearanceDefault; I declared the textfield globally and I allocated the text field in CellForRowAtIndex and my code is: if(indexPath.section == 1) { eventTextField = [[UITextField alloc]initWithFrame:CGRectMake(10, 15, 300, 50)]; eventTe...