objective-c

How to limit NSTextField text length and keep it always upper case?

Need to have an NSTextField with a text limit of 4 characters maximum and show always in upper case but can't figure out a good way of achieving that. I've tried to do it through a binding with a validation method but the validation only gets called when the control loses first responder and that's no good. Temporarly I made it work by ...

Can I create properties with a public getter and private setter?

I'd like to use properties for my instance variables, but in many cases, I only want the class itself to have access to the setter. I was hoping I could do something like this: Foo.h: @interface Foo { NSString *bar; } @property (readonly) NSString *bar; @end Foo.m: #import "Foo.h" @interface Foo () @property (copy) NSString *bar...

iPhone Application - How can one View call a method in another View?

I'm making a simple tab bar iPhone application. It has two tabs, one with a UIWebView and the other with a few text fields to hold settings, and a button to save the settings. What I want to do is reload the UIWebView when the user clicks save on the settings tab/view. I already have it saving the settings, I just need to figure out h...

Disable auto correction of iPhone text field

Hello All, When I try to edit texts in my iphone application (UITextfield), it auto-corrects my input. Could you let me know how can I disable this? Thanks. ...

Declare External Functions In A Cocoa / Obj-C Project.

Ok, here goes. I've completed a Cocoa foundation-tool that calculates mean absolute deviation of random integers (Just as a learning project). I've moved the calculation into a function called "findMeanAbsoluteDeviation()" It accepts a NSMutableArray of NSNumber objects to preform calculations. Anyways. So this works all fine and dandy...

How can i install our iphone project without connect the divice but only using device ID?

I want to build my iphone application only using device ID without connecting the device to my apple PC.Can i do this?If yes then how can i do that. please give me some instruction on it. ...

How can I round a float value to 2 post decimal positions?

I've got a float value from an accelerometer which looks like this: -3.04299553323 I'd like to get -3.04 for example. Is there an easy way for rounding that float value? Edit: http://stackoverflow.com/questions/752817/rounding-numbers-in-objective-c ...

How to display key values in toolbar which is on keyboard

Hi to all I am developing one application. In that I have toolbar on keyboard. But I want that when I press keys, the key values should be displayed in toolbar textfield. So if anyone knows kindly reply. ...

How would you access a C structure's members without knowing the name?

I'm dealing with an undocumented API that I'm trying to do a bit of reverse engineering on - don't worry this isn't malicious, just trying to fulfill a use case in a creative way. I've got a pointer to a C structure. Is there a way for me to determine by examining the memory how many members this structure has? Their values? I suspec...

NSOperation on the iPhone

I've been looking for some concrete scenarios for when NSOperation on the iPhone is an ideal tool to use in an application. To my understanding, this is a wrapper around writing your own threaded code. I haven't seen any Apple demo apps using it, and I'm wondering if I'm missing out on a great tool instead of using NSThread. The ideal s...

How to represent Money in Objective C / iPhone

Hi Im working on an iPhone application and want to represent money ($) amounts. I can't use float because they introduce certain amount of rounding errors. What can I use? Im thinking of defining my own Money class and store dollars and pennies as NSInteger internally. @interface Money : NSObject { //$10.25 is stored as dollas=10 ...

Objective-C Singletons and LLVM/clang leak warnings

I'm using the singleton pattern in several places in an application, and I'm getting memory leak errors from clang when analyzing the code. static MyClass *_sharedMyClass; + (MyClass *)sharedMyClass { @synchronized(self) { if (_sharedMyClass == nil) [[self alloc] init]; } return _sharedMyClass; } // clang error: Object ...

Formatting a (large) number "12345" to "12,345"

Say I have a large number (integer or float) like 12345 and I want it to look like 12,345. How would I accomplish that? I'm trying to do this for an iPhone app, so something in Objective-C or C would be nice. ...

Instantiating Custom Class from NSDictionary

I have a feeling that this is stupid question, but I'll ask anyway... I have a collection of NSDictionary objects whose key/value pairs correspond to a custom class I've created, call it MyClass. Is there an easy or "best practice" method for me to basically do something like MyClass * instance = [ map NSDictionary properties to MyClass...

Persist and rearrange the order of Core Data records

I followed the Core Data tutorial at http://macresearch.org/cocoa-scientists-part-xxiii-itunes-ifying-core-data-app The finished application displays data in an NSTableView. Is the ordering of the data persistent as well? And is there a way that you can allow drag and drop rearrangements to the order of the records? I am thinking ab...

Problem with NSString and NSMutableURLRequest

I am having issues with adding a header to NSMutableURlRequest, the problem is that when I add the header below "Authorization" it does not show up. However if I replace my instance variable "auth" below with a static string exp (@"asdadsadsadga") it the "Authorization" header will show up. I am pretty lost at this point. NSURL *url = [...

Problem with retreiving Array data stored in plist File

Hi, I have a problem, how can we retrieve the array data stored in plist file. The plist file and source code is as shown below, ------------------------plist File------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;...

Get keyboard input without a text field/view

I'm making an iPhone application that has my own custom text view that can display multi-formatted text and I need to interact with the keyboard somehow. Right now I am using a hidden UITextField and the delegate method textField:shouldChangeCharactersInRange:replacementString: to get the typed characters. However this feels kludgy and I...

What does having two asterisk ** in Objective-C mean?

I understand having one asterisk * is a pointer, what does having two ** mean? I stumble upon this from the documentation: - (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary **)errorInfo ...

How to detect iphone is on silent mode.

I am developing one application. In that I want to detect through coding that "is iphone on silent mode or not?". I am developing it by using cocoa with objective-c. If anyone knows it kindly reply. ...