objective-c

How do I subclass NSDate?

Hi, I first time tried to subClassed an NSDate to give it 2 methods that I need. Compiles fine, but in runtime I try to access it I get an error. Lets say I just want the current date which is unmodified in the subClass: [myNSDate date]; I get the error -[NSDate initWithTimeIntervalSinceReferenceDate:]: method only defined for ab...

NSDictionary with key => String and Value => c-Style array

I need an NSDictionary which has key in the form of string (@"key1", @"key2") and value in the form of a C-style two-dimensional array (valueArray1,valueArray2) where valueArray1 is defined as : int valueArray1[8][3] = { {25,10,65},{50,30,75},{60,45,80},{75,60,10}, {10,70,80},{90,30,80},{20,15,90},{20,20,15} ...

Exposing model object using bindings in custom NSCell of NSTableView

I am struggling trying to perform what I would think would be a relatively common task. I have an NSTableView that is bound to it's array via an NSArrayController. The array controller has it's content set to an NSMutableArray that contains one or more NSObject instances of a model class. What I don't know how to do is expose the model i...

How to animate line-drawing in iPhone development?

I have been searching around, but there seems no good answer for this simple question. So I am asking again: how to animate line-drawing in iphone dev? Basically what I want is something like this: @implementation MyUIView - (void) triggerLineDrawing: (CGPathRef) path { ... // animate line drawing here // and the line should ...

setting background image of UIToolBar in iphone

Hi all, I want to set some background image of uitoolbar in my iphone application. Currently i am setting by using the initwithpatternimage method of uicolor. But its not doing what i want. Kindly sujjest some other solution. ...

How to integrate location information into Twitter app?

I'm trying to get a Twitter iPhone app working using Matt Gemmell's MGTwitterEngine. I can post tweets OK, but I can't work out how to attach location data to those tweets... anyone have any idea? ...

Image on Navigation Bar Back Button

In our application I use Left and right button on navigation bar. I want a image on back (left)button.If i use segment for that then necessary to define a action for back button. Please advice me for any method. ...

How to discover whether Geo-tagging is enabled with Twitter / MGTwitterEngine?

Using Matt Gemmell's MGTwitterEngine, how would I find out if the user (that i'm logged in as) has geo tagging enabled? According to the Twitter API, there is a 'geo_enabled' boolean flag, but I can't work out how to interrogate it using MGTwitterEngine. http://apiwiki.twitter.com/Geotagging-API-Best-Practice ...

What are the best tricks for learning how to -think- in Objective-C?

Before I get flamed out for not checking previous questions, I have read most of the tutorials, and have Hillegass' book, as well as O'Reilly's book on it. I'm not asking for tips on Cocoa or what IDE to use. Where my issue lies - my 'mental muscle memory' is making it hard for me to read Objective-C code. I have no problems at all re...

Copying blocks (ie: copying them to instance variables) in Objective-C

I'm trying to understand blocks. I get how to use them normally, when passed directly to a method. I'm interested now in taking a block, storing it (say) in an instance variable and calling it later. The blocks programming guide makes it sound like I can do this, by using Block_copy / retain to copy the block away, but when I try to run...

cc1obj: error: type '({anonymous})' does not have a known size , Xcode

huh? google returns nothing on what this error is... All I am doing is adding a movieplayercontroller to a flipside iphone app. cc1obj: error: type '({anonymous})' does not have a known size {standard input}:228:non-relocatable subtraction expression, "L_OBJC_SELECTOR_REFERENCES_9" minus "L00000000004$pb" {standard input}:228:symbol: "...

How do I use sqlite3 PRAGMA user_version in Objective-c?

I am trying to check the user_version of the sqlite DB. I have an admin tool to bump the version, but I don't understand the syntax of the pragma statement. I am expecting to test the value in an if-statement. Can someone provide a code sample? When I embed the pragma statement in my objective-c code, the compiler throws an error. ...

Can I view all instance variables in a project in one file?

I'm using xcode and I was wondering if there was a way to view all instance variables in my project from one "central" file? ...

Retain, reuse, release?

I've got a series of buttons that each use a different image. Can I reuse a retained variable like this below: // set images UIImage *image = [[dice1 backgroundImageForState:UIControlStateHighlighted] retain]; [dice1 setBackgroundImage:image forState:(UIControlStateHighlighted|UIControlStateSelected)]; image = [dice2 backgroundImageForS...

Can I create a UITableViewController that inherits from a custom subclass of UIViewController?

I have common functionality that I need to access from all screens of my app: a right bar button item and associated action. So as not to repeat the code I would like to set this up in a custom UIViewController and have all my view controllers inherit from it. - (void)viewDidLoad { UIBarButtonItem *rightBarButton = [[UIBarButtonIte...

Delay the call to the delegate method - mapView:regionDidChangeAnimated:

Whenever the user scrolls map or zooms in/out, this method gets called instantaneously. I want to delay the call to this method by say 2 secs. Is it possible to do that? ...

Cocoa touch - GameKit GKPeerPickerController devices

Hi, I'm now testing GKPeerPickerController. I have a simple app that just have a button and do GKPeerPickerController on a device. However, all it does is "Looking for other iPhones or iPod touches..." I do have another device nearby with bluetooth turned on BUT without the app installed. Does that other device also need to have the ap...

Naming convention in Objective C /C , start with "_"?

Something I see ppl define the variable like this: b2World *_world; b2Body *_body; CCSprite *_ball; instead of b2World *world; b2Body *body; CCSprite *ball; I familiar with the second one, but not the first one. So, I checked the Wikipedia about naming convention: Names beginning with double underscore or an underscore and a...

Getting SHOUTcast metadata on the Mac

I'm creating an application in Objective-C and I need to get the metadata from a SHOUTcast stream. I tried this: NSURL *URL = [NSURL URLWithString:@"http://202.4.100.2:8000/"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL]; [request addValue:@"1" forHTTPHeaderField:@"icy-metadata"]; [request addValu...

iPhone Core Data how to update the NSManagedObjects .h & .m after making changes to the data model

I have made a data model, and now I've made a 2nd version. All of the generated NSManagedObjects mapped to that data model are all version 1. Is there some way to update them to v2 without deleting them and then saying having them generated again? ...