objective-c

C Sockets Ping Command?

Can someone point me to some tutorial on how to set up a ping method using C sockets? Using beej's guide, I've been able to set up a connection between two devices, but now I want to setup a method that pings for all available devices before starting an actual connection. I've never done this before, so would you do something like set up...

Need help with YUV display in OpenGl

I am having trouble displaying a raw YUV file that it is in NV12 format. I can display a selected frame, however, it is still mainly in black and white with certain shades of pink and green. Here is how my output looks like Anyways, here is how my program works. (This is done in cocoa/objective-c, but I need your expert advice on pro...

Objective C - Making UILabel update as user types text in UITextField

How would I make a UILabel update as a user enters text in a UITextField. In my case, I have a quadratic equation solver for the iPhone and as the user enters the values of a b & c, I want a UILabel to update with the numbers given by the user. ...

Observing NSMutableDictionary changes

Is it possible to observe (subscribe to) changes to values stored under different keys in an NSMutableDictionary? In my case the keys would already exist when the subscription is initiated, but the values change and I would like to be notified in this case. I would like the key of the changed value in the notification. I assume that if ...

Very basic XCode Objective-C question

I'm making a simple program in Objective-C. It has one class with a lot of methods. I'd just like to put the methods in another file... so I could move the following - (void) myfunc1 {...} - (void) myfunc2 {...} // more functions to another file and replace the above w/ something like #include "myNewFile.something" I'm fine w/ p...

using NSNumberFormatter with NSDecimalNumberHandler in the iphone sdk

as a quick test of formatting very large, precise numbers i'm doing: (number is a synthesized NSDecimalNumber...) number = [[NSDecimalNumber alloc] initWithDecimal:[[NSDecimalNumber numberWithDouble:420000008698643507200000.0F] decimalValue]]; DLog(@"unformatted: %@", [number stringValue]); which gives me: "unformatted: 4200000086986...

Organizing code in Objective-C and XCode

I have some Objective-C code that looks like this: #define myVar 10 float f = 10.0; - (void) myFunc{ ... } #define anotherVar 20 float z = 30.0; - (void) myFunc2{ ... } // and so on It's all in one class. I'd like to put the first block of code into another file and just reference it somehow. So the above code would end up looking...

Keep iPhone keyboard-aligned toolbar visible through first responder change?

I'm using the method described by Josh in this question to add a toolbar to the top of the iPhone's keyboard. Basically, the idea is: Add the view controller as an observer for the notifications UIKeyboardWillShowNotification and UIKeyboardWillHideNotification in its initialization method Whenever those notifications are posted, animat...

Keyboard doesn't disappear

While using UITextField in objective c, keyboard appears, after typing some figure I wanna move to another Textfield or button but neither the cursor removes from text field nor the key board disappears. Wat should i do? tempTextField.borderStyle = UITextBorderStyleBezel; tempTextField.textColor = [UIColor blackColor]; tempTextField.fon...

iphone SQLite Select Query doesn't work

Hi, In the code below, I am connecting to an SQLite Database, the SELECT query didn't work. I hope you can help me. Thanks if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { // Setup the SQL Statement and compile it for faster access const char *sqlStatement = "select name,score from game Where name='interclock'"...

Can UILabel's drawTextInRect method be overridden to change the size of UILabel's text?

Apple's documentation for drawTextInRect seems to indicate this is possible: "By the time this method is called, the current graphics context is already configured with the default environment and text color for drawing. In your overridden method, you can configure the current context further and then invoke super to do the actual draw...

Objective-C Method Types

Hi, I'm just starting to teach myself objective-c and attempting to learn the cocoa touch frameworks, as like many people recently I have developed an interested in a certain little multi-touch device. Anyway, I'm following the Stanford tutorials and I have couple of Objective-C books that im starting to make my way through. While comp...

How to implement a Cocoa-based Adobe Photoshop plugin

Cocoa used to work on CS3 with the trick of putting a Cocoa bundle inside the main Carbon plugin bundle, loading it from Carbon and issuing a NSApplicationLoad(). That's because Photoshop CS3 was Carbon-only and used to unload the plugin bundles. Photoshop CS4 uses Cocoa and has its own NSAutorelease pool in place on the main thread. ...

Detect the specific iPhone/iPod touch model

I am making a game that utilizes the peer-to-peer bluetooth capabilities of the iPhone (and probably the iPod touch 2nd generation). However, to stop the users from trying to play a multiplayer on an iPod 1st gen and iPhone 2G I need to check for the specific device model. [[UIDevice currentDevice] model] will only tell me if the device...

Starting iPhone Development

I'm soon going to be starting some iPhone Development (3.0) building a simple app that communicates with a web service and uses push notification. My objective-c is pretty much non-existent but I've already got some good information from this question and also from Apples development centre. Basically if you've developed with the iPho...

NSURLConnection delegate didReceiveData trailing characters in data

I've really struggled to figure out why my web service call is riddled with junk data. I have a UITableViewController that calls the web service and also acts as the NSURLConnectionDelegate. Here is the delegate method of interest, note the NSLog statements. - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)d...

Sending data via a socket from Objective-C to Java

I have a Java program (call it Jack) and an Objective-C program (call it Oscar), which I run on the same Mac OS X computer. Oscar sends a string message via a socket to Jack, once per second. For reliability and performance would it be better to maintain an open socket between Jack and Oscar? Or would it be better to repeatedly open a ...

Reference from UITableViewCell to parent UITableView?

Is there any way to access the UITableView from within a UITableViewCell? (if the cell belongs to that tableView? ...

Finite State Machine in Objective-C

Does anyone have a solution for a basic, compact Finite state machine/automata written in Objective-C code? I am interested in reusable components so that the FSM have states added and actions defined that use reusable state classes. ...

Crash Reporter for Cocoa app

I'm working on a Cocoa app targeting Leopard and above, and I'm thinking about adding a crash reporter to it (I'd like to think my app won't crash, but let's get real here). I have some mostly conceptual questions before I really get started. 1) How does this work conceptually, knowing when there's a crash and bringing up a reporter? Do...