cocoa

How to compile an OSX Cocoa framework from code in an iPhone project?

This question comes from this other one I asked earlier: http://stackoverflow.com/questions/3180574/calling-custom-objective-c-from-a-pyobjc-application I want to re-use a small part of the app logic from my iPhone app in its server-side component, which runs on OSX. Based on what I was told in the other question, it looks like I need ...

NSTask launch path not accessible

Hello, I am using the following code in my Cocoa project to call a script I made. The script is in the same folder as the project and even shows up under the "Resources" folder in XCode. The proper path is found, but it still says that the path is not accessible. Help please. NSBundle *mainBundle=[NSBundle mainBundle]; NSString *path=[...

How to add text to NSTableView

I made a Cocoa application that has an NSTableView, an NSTextField, and an NSButton. The user enters text into the text field and clicks the button. When the user does this, I want the text in the textfield to be placed in the NSTableView. I find that I can't even bind an IBOutlet to a cell in the NSTableView. What should be done? ...

What happens if two ObjC categories override the same method?

I know of a couple of rules regarding Objective-C categories: Category methods should not override existing methods (class or instance) Two different categories implementing the same method for the same class will result in undefined behavior I would like to know what happens when I override one of my own category methods i...

How do I setup a reference variable to another variable/UILabel variable?

Let's say I have several lines of code to clarify specific settings on a given UILabel variable: numberMarkings[selectedBoxX][selectedBoxY][selectedSquareX][selectedSquareY][selectedNoteX][selectedNoteY].text = @"derp"; numberMarkings[selectedBoxX][selectedBoxY][selectedSquareX][selectedSquareY][selectedNoteX][selectedNoteY].cente...

Key Value Observing and NSButton state

I'm trying to observe checkbox status and make appropriate changes in the app when checkbox status changes. In a window manager that manages the window with checkbox I have following observer setup: - (void)awakeFromNib { [myCheckBox addObserver:self forKeyPath:@"state" options:(NSKeyValueObser...

How to restore previous firstResponder?

Hi, I'm having some difficulty understanding exactly how the responder chain works in an iPhone application. My situation is as follows. I have two UIViewControllers that are installed on a tab bar controller. Call them view controller A and B. They are unrelated in the sense that neither of them has a reference or knows about the othe...

ABTableViewCell Height

I'm using ABTableViewCell by atebits: http://github.com/enormego/ABTableViewCell http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/ The one thing I can't figure out is how to change the height of the cell. Due to the drawing method, I don't think it responds to the normal methods that I've found for changing the...

Cocoa Touch - iPhone App crashes when button is pressed?

This is my first app. It doesn't crash the simulator just brings you back to the home screen. This isn't my first cocoa program (I'm not a pro at cocoa either)just my first iPhone. It crashes when you press the letsPlayButton, which runs the -(IBAction)letsPlay:(id)sender; method. Help me! Im so lost with what's wrong! .H #import <...

Cocoa Sync Services exception

I try to program a Cocoa application with Core Data and the Sync Services framework, it works quite well, but once I try to start the sync, i get the following exception: >[NOTE: this exception originated in the server.] can't register schema at /Users/sdk/Documents/Knoma/build/Release/Knoma.app/Contents/Resources/KnomaSchema.syncsche...

Showing the NSToolbar only if hovering over the NSPanel

I am making a desktop application and I want to show the NSToolbar of an NSPanel only if the mouse pointer is positioned over that NSPanel. Also, when the mouse pointer is not positioned over that NSPanel, the NSToolbar should be hidden. Can anyone help me with detecting the hovering over the NSPanel, and showing and hiding the NSToolba...

NSTask sending an argument through /bin/sh or /bin/bash problem Cocoa Objective-C

Hello, Basically I've passed a script in the terminal through /bin/bash "[path]" or /bin/sh "[path]", and I've passed commands in a terminal through /bin/bash -c "[command]" or /bin/sh -c "[command]". Both ways work properly. But in my Cocoa App, when I try to do the exact same thing with NSTask (using /bin/bash or /bin/sh), the app see...

Closing panel in one source file from a separate source file

This is what I got so far. - (IBAction)HUDPanelDictionaryHide:(id)sender{ extern NSPanel HUDPanelDictionary; [HUDPanelDictionary close]; } This obviously does NOT work. The HUDPanelDictionary is declared in a separate .h and .m file for an .xib file. I need to close this panel from the other .h and .m file for another .xib ...

How to create an IBOutlet in Interface Builder

I know how to create IBOutlets in Xcode but how do you do it in Interface Builder? ...

How to access files within my bundle?

I have a simple question, but don't seem to see the answer in a previous thread, so here goes. I want to access image files within my bundle, and the paste this string into html in various UIWebViews. The code below seems to return a garbage string. It does not return nil, so I assume my found. NSString *imageString = [[NSBundle ...

Menu item doesn't show when creating menu in Interface Builder

In interface builder I added a menu item to the main menu. I can click on the menu and access its contents, however the title of the menu item doesn't show when running the program. The image shows the application and its menu on top and on the bottom is the application as it appears in IB. Notice that where the menu in IB has the "Calc...

detect if iPhone/iPad is password protected

I am fairly sure that this would not be possible, but just want to check. Is it possible to work out if a user has their iPhone/iPad password protection turned on. We are working on an application that contains very sensitive corporate information, we would like to avoid having to ask the user their password every time they open the iP...

Add a subview to a window, along with a specific key to toggle visibility?

I've figured out how to create a new UI element where I touch and add it using [self.view addSubview:[uilabel reference]]. However, if I tap in the same place, it'll simply add another subview on top of the current one. I am able to create a unique key for each part of the grid I'm making (and thus placing subviews). Is there any way I ...

How to Crop image to the maximum image rect?

Hi, In Mac OSX, I have an image with black pixel in all 4 directions. I want to programmatically crop the image to the maximum image rect. Should i check for the black pixel and then create the crop rect or is there any supported API is there? ...

In objective-C, I have a NSString with one letter in it. How can I get the ASCII value of that letter?

for example: NSString *foo = @"a"; How can I get the ASCII value of this? (I know it is really 97, but how can I get it using Objective-C?) I guess I can convert it to char but I had no luck with that so far. Sorry for being too nooby! ...