objective-c

self.title = @"My Title";

Can this be set more dynamically instead of hard coded? self.title = @"My Title"; // ^^^^^^^^^^^ I want the title to be the name of the row the user clicks on instead of Hard Coded Title name In my viewController, I have State Names. I want the title to be the state name the user clicks on. Any suggestions? Thanks in advan...

App crashes without Garbage Collection enabled

As the title says, my app crashes when garbage collection is not enabled. The app pops up for a few seconds and then it just crashes, with nothing but this in the debugger console: [Session started at 2009-08-17 15:03:20 -0600.] GNU gdb 6.3.50-20050815 (Apple version gdb-966) (Tue Mar 10 02:43:13 UTC 2009) Copyright 2004 Free Software F...

Reading and Updating application settings from NSUserDefaults using Flipside View Controller.

Does any one have a good sample to read and update application settings from NSUserDefaults using a flipside view controller. I'd like to read and edit 4 fields stored in textbox, pickerview and a slider control. Any sample code would be helpful. ...

String Help - Objective C

Hi all, I'm trying to make an app that will respond to your command when inserted. So you type in any text in the first box and press enter. It will respond with a response in the 2nd field. I'm not sure how the coding is done here. I'm having trouble with the "if inputbox text = @"whatever", I'm pretty sure that is completely off. Here...

Capture iPhone screen with status bar included?

I am looking for a way to capture a screenshot on the iPhone with the top status bar included, I am currently using the following code: UIGraphicsBeginImageContext(self.view.bounds.size); //self.view.window.frame.size [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentI...

Testing for IP address reachability from the iPhone

I've inherited a iPhone application/project that opens a socket connection to another device (think web cam). This works fine as long as the device is reachable over the wifi network. However, if it isn't reachable, the application hangs calling "connect". (Error checking stripped out for clarity.) -(void)connect_to_control:(NSTime...

UIPickerView: last value followed by first value

Hi! Can anyone help me how to make the UIPickerView displays the first row's value after the last row's value, just like the UIDatePicker where after 12 the 1 will follow. Thanks ...

Read and update a Dictionary type PSMultiValueSpecifier from NSUserDefault.

Does anyone know how to easily read a Dictionary type PSMultiValueSpecifier from NSUserDefault into a UIPickViewer control and save changes back to NSUserDefaults using iPhone SDK 3.0? If so, can you post some specific code to efficiently do this? ...

the future of objective c?

I am currently a c# developer(one year's working experience with bachelor degree in china), now there is another job opportunity as an objective c engineer and i am kind of interested in that position. but what bothers me is the future of objective c, is it a dying language living in the shadow of c++, java and c#? or it is a good langua...

How can I organise my resources into folders?

I'm working with a lot of files in my resources directory and I'd like to create folders to organise them. I've made a folder of plists, but I can't access it. Here's the code that works: NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"plist"]; and the code that doesn't work: NSString *path = [[NSBund...

passing object from iphone app to library in object C

Hi there, I've one application and two lib files. Application initialize a class object which need to pass to another class which is in the library. How can i do that? Here is what i did but it just crash mainClass.h @interface mainUIDelegate: NSObject<UIApplicationDelegate> { bla bla... myCppClass myCppObject; } mainClass.mm -(v...

Set OpenFeint Custom Start Tab (iPhone App)

I'm currently setting up OpenFeint for an iPhone application. By default, the first tab that loads is "Friends" (the third tab in the tab view list) but I'd like to customize this to load the main tab for our application (the first tab in the list). Anyone know how to accomplish this? Any help would be much appreciated. ...

iPhone dev view swapping

So I'm trying to find out the best way to swap views for an iPhone game I'm making. I have a "root view controller" that has a reference to all the view controllers I want to swap between. So I add the main menu view to this root view controller - [self.view addSubview:mainMenuController.view]; - Then in the main menu view I have an in...

Objective C - Using an accessor if It does nothing different

In objective c, if the using the getter and directly accessing the ivar do exactly the same thing, no lazy loading code in the getter, all it does is returns the ivar, would you still use the accessor or access the ivar directly since there is no difference? Why? EDIT: I'm talking about inside the class. ...

ObjectiveC Copying object from one NSMutableArray to another "invalid lvalue assignment"

Hi, I'm trying to make an object in one array equal to another. If I set each property individually, it works fine, but I want to set one object equal to antoher without writing a function to run through each property. -(void)DrawCard: (int) wp{ [self GetNc :(wp)]; if (nc > 0){ ((card*) [[Hands objectAtIndex:wp] objectAtIndex:nc]) = (...

Why doesn't Cocoa like this URL?

I'd like to submit to the following URL in a Cocoa app and save the results to a string (although XML is probably better): http://translate.google.com/translate_t#en|fr|hi%20there%20all The page keeps returning an error. Here's my code: NSString *urlString = @"http://translate.google.com/translate_t#en|fr|hi%20there%20all"; urlStrin...

iPhone Screen Rotation: Can I enforce 90 degree rotations?

My iPhone app rotates fine in the simulator but when I deploy it on a physical device, rotating is very very sensitive. How can I fix this issue and make sure the screen rotates only when a 90 degree angle is made? ...

Syncing Core Data model between Mac and iPhone

I am currently building my Core Data model, which I would like to sync between the Mac and iPhone versions of my application. I will be using Bonjour for device discovery, etc but I have a question regarding the data sync part of the problem. So far I have added a UID and modification timestamp to each object that will be involved in s...

Optimal way to persist an object graph to flash on the iPhone

I have an object graph in Objective-C on the iPhone platform that I wish to persist to flash when closing the app. The graph has about 100k-200k objects and contains many loops (by design). I need to be able to read/write this graph as quickly as possible. So far I have tried using NSCoder. This not only struggles with the loops but als...

Why doesn't NSEnumerator iterator recognize object properties within DrawRect?

I usually have no problems using NSEnumerator in the iPhone sdk but this is my first time using it within the DrawRect function of a UIView. The NSEnumerator iterator is causing an error: request for member "(member)" in something not a structure or union. 1) Why is this happening? 2) How can I workaround it? (P.S. the member not bei...