objective-c

UIImageView and UIImage of equal size

I came across a weird scenario in my code the other day: I have a UIImageView that loads an image with setImage:. The UIImageView is prior initialized with a frame having the exact size of the image (41*41 px). I also set the content mode to UIViewContentModeCenter, which should ensure my image is never scaled. Now when I look at my im...

uiimage and uibutton release problem?

I've been coding for a while now in objective-c and am comfortable with it... but one thing eludes me. Memory management. I'm releasing as I think is correct, but this bit of code is throwing a "EXC_BAD_ACCESS" and crashes the app. When I comment out and DON'T release the button and image, it works fine. The function is called to read t...

Access nested arrays and dictionaries generated by JSON-framework iPhone

I'm using a Google API to return some JSON, which i have converted to their Objective C types using the JSON-framework (Stig B - Google Code). I now have structures like this: responseData results [0] title = "Stack Overflow" cursor How can i access the nested array results to get at the title value (dicti...

Single-Stage vs Two-Stage Animation for iPhone Apps?

What are single-state and two-stage animation for rotating an iPhone window? This is the "error" message I get in the Debugger Console (nothing crashes): Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations. I was working through the book "Beginn...

Tool for debugging KVO/Bindings in Cocoa

Is there any tool to log current observers of a given object, in the spirit of what "gdb info gc-roots" does? I found "gdb info gc-references" could do that (sort of) as a by-product of its original purpose, but that won't work with non garbage collected apps. Thanks! ...

Cocoa Programming on Windows

Is there a way to develop windows applications using cocoa and objective-c in general ...

How do I look at the text value of a label?

Hello I am really getting frustrated now! I have a new problem now, all I want to do is say if lblMessage.Text = "30 Seconds" then do some code otherwise do some other code if (lblMessage.text isEqualToString:@"30 Seconds") { NSString *strPlayerAtTable = [[NSString alloc] initWithFormat:@"%@ at table", ActivePlayer]; lblMes...

NSTextView yellow highlight like in safari search

I've done this before but I simply can't remember how I did it =( So what I'm trying to do is to select a range in a NSTextView and make it visible with the yellow box similar to Safari search. As far as I remember there is a build in API for this but after searching like crazy I haven't found it. And I've asked about it once before on ...

iPhone simple method definition and calling the current date/time

I'm very new to iPhone development, and I'm trying to write a function which will accept one parameter, and return the current date/month and store it in a variable. But I'm getting a (null) value with NSLog. Method: -(NSString *) getNowDateMonth:(NSString *)type { NSDate *now = [[NSDate alloc] init]; if (type==@"month") { ...

Avoiding #import of header for abstract-only parent class

I develop CHDataStructures, a library of Cocoa data structures to supplement those in Foundation. It includes a fair number of classes (stacks, queues, and dequeues) that share common implementation details, so it makes sense to design them with a common parent class which I treat as abstract (Objective-C doesn't natively enforce this co...

Call reloadData on a UITableView from a different controller

I have a table view that uses a location manager to grab the users location. In my didUpdateToLocation method, i create an NSURLConnection to go off to my webservice which returns JSON. The delegate of the Connection is set to an instance of my JSONController class and in its connectionDidFinishLoading method, i need to call [tableView ...

How to log data & type from a void pointer?

I have the following code: eachShape(void *ptr, void* unused) { cpShape *shape = (cpShape *) ptr; id obj = shape->data; NSLog(@"shape->data: %@", obj); // this is where EXC_BAD_ACCESS can occur ... Some of you may recognize it from the Chipmunk physics framework used in iPhone development. Basically I crash here because of s...

How can one develop iPhone apps in Java?

Hi there, In my computer science class, I have completed all my projects; So my teacher thought it'd be a good idea to develope IPhone apps. The only problems is that the class is taught in java, and IPhone apps are written in Objective-C. I was wondering if anyone has developed applications in Java, with XMLVM. This compliler (supposed...

Wondering how to deal with nsnumber objects in an arithmatic operation

I saw this thread but wanted to confirm: http://stackoverflow.com/questions/1801197/how-to-convert-nsnumber-objects-for-computational-purposes So basically anytime you want to deal with these objects you have to unpack their ivars, and then pack them back up into new objects, presumably NSNumbers? That seems hella weak(and a large pai...

Mobile web interface for Google Calendar?

I'm writing an iPhone app in which I would like to display a public Google Calendar. I love their mobile interface for Calendar that is available when you log in, but I am wondering if there's a way to display this or a similar interface for public Google Calendars. Currently I'm displaying the desktop version of a public Calendar in a U...

Parsing XML not working, why?

- (void)parserDidStartDocument:(NSXMLParser *)parser { nestedChannels = [ [ NSMutableArray alloc ] init ]; .... } - (void)parser:(NSXMLParser *)parser didStartElement.... { Channel *channel = [ [ Channel alloc ] init ]; [ nestedChannels addObject:channel ]; .... } - (void)parser:(NSXMLParser *)parser foundCharacters...

Unknown problem in my code - Console says: unrecognized selector sent to instance - I try to use the MGTwitterEngine

Hi, since yesterday I've got a bug in my application and I don't get where it is. Actually I am pretty sure that I did not change anything and that it worked perfectly yesterday. I do not intent to publish all of the code but I can post my first ViewController, if you want. The problem occurs in both ViewControllers. I use the MGTwitt...

Problem with building applications

Hi. I am currently running Mac OS 10.6.2, with Xcode 3.2.1. When I try to build any application, at all, I get this error: "No object for "com.apple.InterfaceBuilder.CarbonFramework" key." I just installed Xcode, upgrading from 2.2.1, and got this error upon making a new application and trying to build. Please help. ...

Chaging the size of UISearchBar + resizing on setShowsCancelButton

I have managed to resize the Textfield of the UISearchBar thanks to this question: Changing the size of the UISearchBar TextField according to the subclassing approach of timmytheRock. The problem is, when the user selected the textfield, I would like to have the cancel button correctly added (i.e. animated and in the right position). R...

Prepopulating UITextView with data?

I have a UIText View that I need to populate with a link that can be gained from currentItem.link. But I can't seem to work out how to populate the text view with the link. I'm assuming you have to load the view with some sort of IBAction? ...