objective-c

Binding an NSPopupButton to an NSDictionaryController

I'm trying out some MacOS programming and having some trouble understanding how bindings work with an NSPopupButton. I'm interested in binding to an NSDictionaryController (I don't think I need an intermediate NSArrayController but if that is the best way, I'm open to it). I've created a controller object that has a property 'db' which...

Problem to populate a Tableview on iPhone

Code N°1: NSMutableArray *arrayTmp = [[NSMutableArray alloc] initWithObjects:nil]; [arrayTmp addObject:@"line 1" ]; [arrayTmp addObject:@"line 2" ]; self.list = arrayTmp; [self.tableView reloadData]; [super viewDidLoad]; [arrayTmp release]; Code N°2: NSMutableArray *arrayTmp = [[NSMutableArray alloc] initWithObjects:nil]; NSString...

Why tack a protocol of NSObject to a protocol implementation

I have been seeing some code around that resembles the following: @protocol MyProtocol <NSObject> // write some methods. @end Is there any particular reason why MyProtocol conforms to the NSObject protocol? Isn't that rather redundant in that if you do something such as: id foo; // foo here conforms to NSObject AND MyProtocol? Just...

How to draw signature with lines on iPhone screen?

I want to let user draw a signature on iPhone screen, so I add a subclass of UIView and add some code to its 'touchesMoved' method. -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; firstTouch = [touch locationInView:self]; CGSize mySize = CGSizeMake(5, 5); UIGraph...

UITableView with dynamic cell heights -- what do I need to do to fix scrolling down?

I am building a teensy tiny little Twitter client on the iPhone. Naturally, I'm displaying the tweets in a UITableView, and they are of course of varying lengths. I'm dynamically changing the height of the cell based on the text quite fine: - (CGFloat)heightForTweetCellWithString:(NSString *)text { CGFloat height = Buffer + [text si...

how to get location in iphone

how can i get the my current location using WiFi programatically in side a room with my WiFi machine. I have two machine which have Wifi and i want to locate my current location on iphone. So how can i get my current location using two machine? ...

Is any font that looks like LED in iPhone ?

Hi, I am develop a simple iPhone app. I need a font that looks like LED. Is any font that looks like LED in iPhone ? ...

Make a UIScrollView get touch events with a UITextView as a subview

Hi, I have a UIScrollView that contains a UITextView (not editable). I can't make the UIScrollView gets the touch events, UITextView seems to get them and keep them . Any idea how to let UIScrollView gets the touch events? I want UITextView to still be scrollable vertically (my UIScrollView is scrollable only horizontally). ...

iPhone RSS Reader -- parseXML won't Load some XML feeds

I am using the SIMPLE RSS reading example found at http://theappleblog.com/2008/08/04/tutorial-build-a-simple-rss-reader-for-iphone/ It uses parseXML to load the RSS feeds. Here is the problem I am having. For the following RSS feed example, I am having trouble getting it to load the feed. Comes up with an error that it cannot connec...

Latency with NSURLConnection due to DNS lookups?

Hi all, I'm banging my head here trying to figure out why there is a three to four second overheard for when an NSURLConnection object is created with a POST based NSMutableURLRequest. The overhead which I speak of, is after an NSURLConnection gets fired off, watching Apache access logs, I see the request come in substantially longer af...

Method Syntax in Objective C

Can someone explain this method declaration syntax for me? In this function, the number of rows of a UIPickerView (slot machine UI on the iPhone) is being returned. From my understanding, the Method is called 'pickerView', and returns an NSInteger. It passes in a pointer to the UIPickerview called 'pickerView' ... first, why is th...

Assigning values to Instance variables in Objective C

The function I'm looking at: -(void)viewDidLoad { NSBundle *bundle = [NSBundle mainBundle]; NSString *plistPath = [bundle pathForResource:@"statedictionary" ofType:@"plist"]; NSDictionary *dictionary = [[NSDictionary alloc] initWithContentsOfFile:plistPath]; self.statesZips = dictionary; [dictionary release]; N...

AMF0 parser in ObjectiveC

Hello guys, I am writing an application which connects to an FLV stream and parse data to extract SCRIPTDATAOBJECT. I successfuly get content of a DATASCRIPTOBJECT and am trying to parse AMF0 data to get some metadata, do you know sample code of AMF0 parsing ? Thanks a lot. Thierry ...

NSTableView sort not getting correct ID

I'm using a Table View in a Cocoa application. I have set the double click action to do the following method when it occurs: - (void)doubleClickInTable:(id)sender { int rowIndex = [sender selectedRow]; if (rowIndex != -1) { [userEditController setData:[[self users] objectAtIndex:rowIndex]]; [self showUserEdit...

Referencing Error to the AudioToolbox in Objective C

I'm getting the following error in a simple Roulett app where I'm trying to play some wav files. I'm not sure what the error means because no warning flags come up in the code, and I've imported Here is the error: Undefined symbols: "_AudioServicesCreateSystemSoundID", referenced from: -[CustomPickerViewController pla...

NSView with variable number of items inside

I'm trying to figure out how to create a view that, depending on the circumstances, has a variable number of items being displayed in it. Something like the grid view in Finder or iTunes, an image with a sort of caption text underneath it. I've heard that you can use an NSCollectionView for this sort of thing, but I don't really know. I'...

how to get distance using Wi-Fi

I want to find the distance using wi-fi and plot the marker on map in iPhone. So any idea or code i can get for that? ...

UIAlertView inside an NSOperation is not modal in iPhone

So I am trying to create a check that tries to connect to the WWW. when it fails it needs to then retry several times before the application gives up and quits. Each time it retries the user is propted with an UIAlertView with the options to Retry or Cancel. So here is the problem. I have a chain of actions in an NSOperationQueue, all...

EXC_BAD_ACCESS crash when releasing NSXMLParser

I'm seeing an intermittent crash on [parser release]. I'd say I see it about 5% of the time, and the data I am parsing varies between each crash. I can't for the life of me figure out why. Before I submit a bug report to Apple (which, with my luck, will not be reproducible in sample code), has anyone run into this and know what might b...

XCode trick: What's the shortcut for the context info?

I don't know the word for that. But there was a keyboard shortcut when you had the cursor on a method or variable, it showed an info box with all available variables/methods for that variable. ...