objective-c

unwanted UIImageView resizing when in a UIView

I'm programatically creating a custom section header for a table that has a width set to 290. When I use a UIImageView containing a 290 x 29 PNG directly the image appears correctly. However, I'm refactoring to include a UILabel so I can do some custom text so I place the UIImageView and UILabel in a UIView. When I view this version, ...

How to create a NSMatrix of NSImageCell in Interface Builder in 10.6

How can I create a matrix (NSMatrix object) of NSImageCell cells (usually located in an NSImageView) in Interface Builder 3.2.1 (i.e. the one made for Snow Leopard?) In the "old days", you would drag an NSImageView, and then option-drag the corner of the control. It seemed to have stopped working in 3.2.1... Is there another way? Am I d...

CG/NSPoint-like integer tuple type?

Is there an appropriate structure provided in the Apple foundation kits to represent discrete coordinate systems? I know I can just use the integral component of NSPoint and by convention keep it discrete, or even define my own. However if there is one already which is typed correctly I would prefer that and avoid implicit / explicit...

Creating an NSMatrix programmatically, Snow Leopard

I'm trying to create an NSMatrix of an NSImageCell prototype programmatically (if you can help me doing it via Interface Builder, be my guest at answering me here) I created a new, empty project. In it, a normal object (subclassing NSObject) has this code (and only this code): - (void) awakeFromNib { NSRect f = view.bounds; NSM...

properties from a parent view in iPhone Navigation Stack

I can't seem to access parent view properties in a navigation stack. See below //the parent to current view (which is at index 2) UIViewController *parentView = [self.navigationController.viewControllers objectAtIndex:1]; //there is an NSArray propery called games in parentView NSLog(@"%@",[parentView.games]); This code gets the erro...

Call from Objective-C into Python

bbum posted an outline of how to do this, but I'm unable to complete the details. Where does the Python code go, and how will my Objective-C code know about it? How would I do it compiling on the command line? ...

Center an NSView within an NSScrollView

How do I center an NSView within an NSScrollView like the way "Preview" does? ...

Catch a subview touch event

I have a UIViewController, and I've added two subviews to its view. One subview is the view of a UIViewController. The other subview is a UITextField. I need to dismiss the keyboard for the UITextField when the user touches the other view, but I can't figure out how to detect those events. The UIViewController's tableView catches the...

how to enable multi touch in cocos?

Could anyone show me how to enable multi touch in cocos please? I am new to this. Really appreciate any helps. ...

touchesBegan converts to ccTouchesBegan??

I am not sure if the way that applied in touchesBegan can be applied as well in ccTouchesBegan or other touches call back. For example I have some code: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSUInteger numTaps = [[touches anyObject] tapCount]; touchPhaseText.text = @"Phase: Touches began"; touchIn...

How do I trim " " and "\n" in NSMutableString.

Objective-C:: How do I trim " " and "\n" in NSMutableString. ...

Assigning variable values to NSTextFields in Objective-C

I'm a complete newbie to Objective-C, coming from a background of PHP, assorted dialects of BASIC, and a smattering of C/C++. While I feel I've got a fair handle on setting basic windows up in Interface Builder, however, I'm having trouble manipulating the content of text fields, especially calling values from them and sending values to...

Objective-C: How to format string as $ Price

Is their a built-in way of formatting string as $ price, e.g. 12345.45 converted to $12,345.45? ...

I want to display a lot of characters including changing line in one cell.

Objective-c:: I want to display a lot of characters including changing line in one cell. It was thought that it only had to decide the height of the cell by the number of lines, and wrote the following codes. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { ..... cell.selecti...

Run-loops and threads in Apple's CocoaXMLParser example

In the CocoaXMLParser class of Apple's CocoaXMLParser example, the following code appears: rssConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; [self performSelectorOnMainThread:@selector(downloadStarted) withObject:nil waitUntilDone:NO]; if (rssConnection != nil) { do { [[NSRunLoop currentRun...

Grouped style setting not taking effect from IB, UITableView

I've created a table view in an iPhone app using Interface Builder (IB). My table style is set to Grouped, and displays that way in IB. However, whenever I build and run, it shows up as a Plain style in the simulator. I have another view set to Grouped and don't experience this problem. Has anyone run into this problem before? The re...

Cannot get Twitter-OAuth-iPhone to work

Hi, demo works as expected, no problems. But now I'm trying to integrate it into my project. I use no xib-s, code only: OAuthTwitterDemoViewController *vc = [[OAuthTwitterDemoViewController alloc] init]; [[UIApplication sharedApplication].keyWindow addSubview:vc.view]; [vc release]; it compiles and runs with no errors, but the actual ...

warning:'UIResponder' may not respond to '-manageTouches:'

Hi, this is my program . //Interface file. #import <Foundation/Foundation.h> @interface reportView : UIView { } - (void)touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event; - (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event; - (void)touchesMoved: (NSSet *)touches withEvent: (UIEvent *)event; @end //Implementati...

Developing WYSIWYG UI/Controller on iPhone

I'm trying to develop a really good and cute looking text message input controller like TTMessageController from three20 but with some simple WYSIWYG controls. For the first step I want to go super-simple and make it have Bod Italic and underlines only. I know it's a very general question but I want to hear... What are the approache...

How to convert a unichar value to an NSString in Objective-C?

Hi there, I've got an international character stored in a unichar variable. This character does not come from a file or url. The variable itself only stores an unsigned short(0xce91) which is in UTF-8 format and translates to the greek capital letter 'A'. I'm trying to put that character into an NSString variable but i fail miserably. ...