objective-c

[iPhone,Obj-C] something:something:something Method Format?

-(void) alertView: ( UIAlertView *) alertView clickedButtonAtIndex: ( NSInteger ) buttonIndex { // do stuff // if you want the alert to close, just call [ alertView release ] } Can someone explain this method? I'm used to methods that are like "-(IBAction)buttonPress:(id)sender" but this one has three. What do ...

What is the difference between an IF, CASE, and WHILE statement

I just want to know what the difference between all the conditional statements in objective-c and which one is faster and lighter. ...

When does webViewDidFinishLoad get fired?

Does anyone have a precise understanding of when webViewDidFinishLoad is called on a UIWebViewDelegate? I've read that it fires once per iframe, if they exist, but I'm concerned about exactly when it loads with respect to the DOM and javascript events. Is all of the javascript and DOM guaranteed to be downloaded, interpreted and ready ...

Save photo to iphone camera roll with a custom name

Hi Guys, I am trying to save a photo taken from my app to camera roll, this can be done by using UIImageWriteToSavedPhotosAlbum, however, I noticed there isn't any way to set the photo name by using this approach, am I right? I also tried to save a image file with a name by using UIImageJPEGRepresentation, however, I can only save it t...

Display Window with Cocoa Framework in Xcode

I'm building a framework in Xcode, and I need to display a window when a function is called. How do I get my framework to display a window that I build in Interface Builder? Step by step instructions would be greatly appreciated! Thanks, Chetan ...

How to change AVAudioRecorder's record settings in another view controller?

Hi all, I'm working on this iphone app that has a view controller to record some sound using AVAudioRecorder. I want to have another "setting" view controller that can change the record settings (recording format, quality etc.). Is there a way to create a singleton object for AVAudioRecorder(something like [AVAudioRecorder sharedInstanc...

How can I derive an address and port from -[NSNetService addresses] so I can use it with NSURL

I'd like to use CocoaHTTPServer to set up peer-to-peer communication between different instances of an application on a network. Setting up the server was quite easy, but writing the client is another story. I have the server broadcasting over Bonjour. My client is able to find and resolve the service, but I'm stuck when it comes to get...

SQLite 'no such table' error

Hi, I'm noob here but, why is it i'm getting this error? I DO have a table named Team in an SQLite called Team.sqlite! Is there anything else I need to provide? ERROR --------------- 2009-12-23 23:17:05.277 PitScout[6690:207] *** Assertion failure in -[Team addTeam], /Users/******/Desktop/PitScout/Classes/Team.m:90 2009-12-23 23:17:0...

Qt4.5 vs Cocoa for native Mac UI

Hey guys, I've been developing for Windows and *nix platforms for quite some time, and am looking to move into Mac development. I am tossing up between using ObjC/Cocoa and C++/Qt4.5. The C++/moc semantics make more sense to me, and improving knowledge in Qt seems like a sensible thing to do given that you end up with a skill set that ...

What is the color of a "Info" view in IPhone's address?

Hi every one, What is the color of "Info" view of a contact info in IPhone? When you're viewing the details of a contract, you can observe that the background color with white lines in the contact's "Info" view. If I want to set the same color to my UIViewController how can I set the same? And one more, when you're viewing a contract's...

Adding custom methods to core data classes

What is the best way to add custom methods to my core data generated classes? For example, say I have a "Person" entity with properties "firstname" and "lastname". I wish to add a "fullname" method, which returns a concatenation of the firstname and lastname properties. I could add the method to the generated .h and .m files, but this...

Access to enclosing/parent NSDictionary of an object.

Is there any method I can send to an object, which will return an enclosing collection (NSDictionary/NSArray)? Or a method which would return a collection of all the objects with a retain call on the object in question? DJS. @bburn: It possibly is a design problem. I'm trying to parse an XML document, and more or less convert the entir...

Setting the Line Height/ Line Spacing in an NSTextView.

How would I set the Line Height/ Line Spacinh in an NSTextView? e.g How tall each line is or how much space is between each line. ...

How do I authenticate a Google user on the iPhone using GData?

Hello, I am new in iphone application. I want to make a simple application in which User can login from google and facebook. I have integrate API's for both of them. I have also completed the facebook connection but I dont know how to validate the Google user with its API (Gdata). Can anybody please help me for authentication of google a...

calculation not working as expected.. any ideas?? (iphone / int)

I have a calculation which isn't working and I cannot work out why! int numHoursInWeek; int numDays; int averageSalary; int total_seconds_in_year = ((numHoursInWeek * 60 * 60) * numDays); NSLog(@"average sal in pence=%i", (averageSalary * 100)); NSLog(@"num seconds in year=%i", total_seconds_in_year); NSLog(@"cost per second=%i", ((a...

How to use Objective C to send device token for push notifications and other user settings to sql table on server

Ideally, I would like to send an HTTP Request using POST to the Push Notification Server that contains the device token as well as some user-defined settings. From there I can set up a php script on the server to deal with the incoming data and input it into an sql table. If this is the only way to do it, how would I go about initiating ...

Learning Cocoa. Should I delve into Apple's documentation?

I have built some basic apps for iPhone and Mac with a general understanding of Cocoa, but haven't had a detailed understanding. Now I want to go deeper. I have just finished the Objective-C documentation at MacDevCenter. It was great to get in-depth look but took far too much time, specially because a lot of it is conceptual, and it's ...

How to use LIKE query in sqlite & iPhone

I'm using the following for a LIKE query. Is this technique for LIKE correct? selectstmtSearch = nil; if(selectstmtSearch == nil){ const char *sql = "SELECT col1, col2 FROM table1 t1 JOIN table2 t2 ON t1.cityid = t2.cityid where t1.cityname like ?001 order by t1.cityname"; if(sqlite3_prepare_v2(databaseSearch, sql, -1, &selectstm...

how show animation when going to second view without using navigate controller ?

Hi, In my test application (im learning) i have 2 view controllers. on the first view i have button "go to second view". what i want to do : when user click the "go to second view", the first view move left and go out of the screen and the second view will appear from the right and replace the first view. now, this animation is happen...

NSNetService delegates not being called

I'm trying to resolve a NSNetService (named "My_Mac") to an IP in a background app with this code: NSNetService *service = [[NSNetService alloc] initWithDomain:@"local." type:@"_daap._tcp" name:@"My_Mac"]; [service setDelegate:self]; [service resolveWithTimeout:5]; And in the same class, I have these delegate methods defined: - (void...