objective-c

Calling methods from Xcode Debugger ?

Hello, what's the correct way to call a method from the Xcode debugger command line ? For example if I'm inside the sort: method of my class A (using the debugger), how can I call debugSort: method that belongs to class A too ? ( My code is Objective-C btw ) ...

CLANG Pass-By-Value Warning?

The following code compiles fine ... int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // VARIABLES MDD *MDD_structure; NSString *mddFile = @"/Users/Gary/Code/Mdd/xTest.mdd"; NSFileHandle *inFile; NSData *inBuffer; int MDD_fCount; int MDD_vCount; ...

What is the right code pattern for NSNumberFormatter?

What is the right code pattern for NSNumberFormatter? There are many example on the Internet (including this one: http://mac-objective-c.blogspot.com/2009/04/nsnumberformatter-some-examples.html) where the NSNumberFormatter is allocated and initialized each time it is needed. Yet some other examples in the Apple Documentation (includi...

How can I hide the UITableView that UISearchBar created?

In my iPhone application I am writing I have a search bar and search display controller. When the user types something in the search box, the table view loads and is now visible. When a user clicks on a row, I would like to get rid of the tableView and go back to the view where the user originally clicked the search bar. I have searched ...

objc_setAssociatedObject unavailable in iPhone simulator

In the 3.1 SDk, Apple added support for associated objects. However, the simulator will not compile code that includes references to objc_setAssociatedObject, objc_getAssociatedObject, et al. (Undeclared errors) Is there away around this? Can I make the iPhone simulator compile this code? I would hate to have to do all testing on the ...

Cocoa Xcode - how to pass a variable to a function

I'm trying to figure out how to pass a variable (in my case hostname) to a function i created from a programatically inserted "menu item". #function -(void)goToTerminal:(NSString *)hostname { NSString *s = [NSString stringWithFormat:@"tell application \"Terminal\" to do script \"ssh root@%@\"", hostname]; NSAppleScript *as = [[...

Making a Method be triggered when a row is selected in a Table View.

How would I trigger a Method when a row in a Table View is selected? ...

Using Functions In External File?

I am new to Xcode and have just gotten to the point where I am starting to build up a few files that I would like to include in future projects. Currently I am importing the file ... #import "/Users/Gary/Documents/Xcode/FG_Include/FG_FloatFlip.h" into my project at... /Users/Gary/Documents/Xcode/mddStructure_PROJ/mddStructure.m How...

How do I kill a back ground running app in iphone?

Hi All, I just want to know how to kill a back ground process/app in iphone. Just like in Auto Lock SBSettings where, the "process" toggle is able to list all the back ground process and allows user to kill any of them. Thanks in advance. Thanks 'refulgentis', 'Chuck' for your quick responses. You're true and also I know that the A...

Finding out if a Window is Resizable

Is there a way to determine whether the active window (not of my process, but a different application) is resizable? Edit: I would prefer to do this without applescript as it then depends on the application being scriptable. ...

Xcode: Get rid of forward class warning

In Xcode, I have a forward class declared so as to avoid a circular import e.g. @class MyClass; And then I do a method call on that class e.g. [MyClass myMethod]; But I get a forward class warning e.g. warning: receiver 'MyClass' is a forward class and corresponding @interface may not exist How can I hide those across my ...

Warning when communicating context from controller to NSView with custom methods

Coding against UIKit for iPhone. Setup, with relevant detail: SomeView.h: #import <UIKit/UIKit.h> @interface SomeView : UIView { SomeObject *myObject; } @property (assign) SomeObject *myObject; -(void) doSomething; @end SomeView.m: #import "SomeView.h" @implementation SomeView @synthesize myObject; - (void)doSomething { ...

iPhone UITableViewDelegate Question.

Hey all, I have a basic question that's driving me crazy. I have a class inheriting from UITableViewController. It is the root controller in my navigation controller. I have another class that implements the UITableViewDelegate and UITableViewDataSource protocols (my delegate). Basically, in my delegate's tableView:didSelectRowAtIndex...

how do we compare 2 class names of an object

Is there a way to get compare class name betweeen 2 objects? Like: NSString *bla = [[NSString alloc] init]; if([bla class] isEqual: NSString]) NSLog(@"success"); unsure if my syntax is correct. ...

Moving multiple UIImageView with UIAccelerometer?

Hi, can anyone post or direct to how move multiple UIImageView objects depending on the Accelerometer movement. thanks. ...

Core Data decorating with sort-compare methods

Hi I have some NSManagedObjects and I would like to write methods for sorting and comparing the properties on them. My problem is that since Core Data defines the properties as @dynamic they can not be referenced at compile time. This means that decorating an NSManagedObject with methods like this: - (NSComparisonResult) compareDateAn...

Snow Leopard Style Pop-Ups

Is there a framework that draws Snow Leopard style popups? For an example of what I am talking about, try right clicking something in the dock. I basically want to be able to give a starting point (where the arrow forms) and then a size and have it do the rest. In this case it's a menu, though my use would be more of just for drawing a ...

NSWindow does not respond to keystroke command-s

Hello, it may pre very simple, but cannot find it: I have three windows in three separate NIBs in my application. One is opened when a new document is opened, the other two can be opened from the program's window menu. The problem is: two windows (in them the one that is opened at the beginning) accepts the normal keystroke as for ex...

CamelCase to underscores and back in Objective-C

I'm looking for a simple, efficient way to convert strings in CamelCase to underscore notation (i.e., MyClassName -> my_class_name) and back again in Objective C. My current solution involves lots of rangeOfString, characterAtIndex, and replaceCharactersInRange operations on NSMutableStrings, and is just plain ugly as hell :) It seems ...

drawing NSImage tiles

how do i draw an NSImage into a view in a manner that it is tiled in a single line (there are no incomplete images drawn, and assuming that the image height is equal to the view's height)? ...