objective-c

Objective C static vs. dynamic constructors

Hi, Is it best to have static constructors where you alloc the instance in the constructor and you return the instance as auto release, e.g. [String stringWithFormat...] or is it best to have dynamic constructors where you ask the user to alloc first so that he is in charge of releasing? When should you use each? Cheers ...

Finding out, whether Bluetooth is enabled or not on an iPod/iPhone

I'm writing an app, that automatically finds peers running the same app, so I need the Bluetooth-device. But because of app-restrictions I'm not allowed to use the private framework to enable, or activate the Bluetooth-device. I'd rather avoid a pointless searching for peers if there's no possibility of finding them. Is there any way to...

Convert NSString in NSArray

Hi, I'm searching for a Objective-C method like PHP's explode function: $string = "Helle#world#!"; $delimiter = "#"; $array = explode ( $delimiter, $string); Result: $array = {"Hello", "world", "!"} Thanks, Andreas ...

Is this possible to connect microsoft database from iPhone?

I would like to connect microsoft database via iPhone, is that possible to do so? Is there any third party library required? If not, any suggestions on that?? Thank you. ...

How to validate an emai id in Iphone sdk?

H guys, I need to validate an email address which was in the format [email protected] As I am new I dont know how to validate the email address. Please guys suggest me how to get out of this. Hope I will get quick response from you guys. Thanks in advance, Monish. ...

iphone - unrecognized selector sent to instance - Trying to open the starting view after viewing serveral other views

I am just starting with iphone programming. I used the utility application project template. A button on the main view of the utility application calls another view which shows some data. At the end of the presentation of the data a "end" view is shown. The "end" view contains a button to return to the main view. This all works grea...

Content touch handling in UIScrollView

I've got to deal with UIWebView embedded into UIScrollView. How do I handle the link touch, for ex. ? ...

AddressBook API woes - NSInternalInconsistencyException

My situation is the following: We're creating an application that (among other things) shows data from the Public Folders in Exchange. We'd like our iPhone App to display contacts like the iPhone does it by default (like Apple's AddressBook app), therefore we're making use of the AddressBook API. However, we don't intend to save any dis...

iPad custom URL help

Hello, So I am trying to probe the UIApplicationLaunchOptionsURLKey to see if my application was launched by another app. For example, what if I want to do something like this: if (UIApplicationLaunchOptionsURLKey != NULL) { [window addSubview:launchViewController.view]; } else { [window addSubview:viewController.view]; } In...

how to launch UIView subclass from UIViewController subclass in ipad

view2 is a subclass of UIViewController. view1 is a subclass of UIView. How do I launch view1 from view2? I've tried [self dismissModalViewControllerAnimated:YES]; and UIViewControllerhandler.hidden=YES; ...

C: What will the statement 'return A || 1' return when A >1?

Although I wouldn't have written it myself, what is the expected result of the following statement where A (guaranteed to zero or positive integer) is greater than 1? return A || 1; In many languages, I would expect A to be returned, unless the value of A is zero, in which case 1 would be. I don't have my C book to hand, but I note ...

What's the code equivalent to the autoresizing mask anchoring options in IB?

How can I get a NSTextField (or any object) to respect the autoresizing options below via code? I want to add new objects to the view dynamically, but when I increase the height of the view, they are anchored to the bottom left, as opposed to the top left as shown, and so new textfields are dropped on top of the old ones. Is this even p...

UITabBarItems don't appear until clicked

Hello, I added a UITabBarController to my ViewController in IB, and created an iVar in the View Controller's class that is hooked up to the tabbarcontroller. I add the tabs in my viewDidLoad method, but the text and images for the tab bar items don't appear until they are clicked on. Any idea why this happens? ...

init is being called and I don't know why?

I am working on the iTuneU Stanford iPhone course HelloPoly drawing assignment, and I am getting a call to my object's init routine when I don't expect one. The callback seem to indicate that the call is coming from _loadMainNibFile (after other calls). What I am trying to understand is why is my object being init-ed implicitly. The sour...

NSCopyObject considered harmful?

In the Xcode documentation for NSCopyObject, the special considerations section states: This function is dangerous and very difficult to use correctly. It's use as part of copyWithZone: by any class that can be subclassed, is highly error prone. Under GC or when using Objective-C 2.0, the zone is completely ignored. This functio...

NSFetchedResultsController and UITableView Sections

I use an NSFetchedResultsController to populate a UITableView, and would like to know if it is possible to create different sections based on an attribute of my data model. I am displaying a table of objects, and one of the properties of the objects is a BOOL that is set to indicate whether or not the object is active. I would like to ...

How to get asian fonts working on an iPad?

I have a PDF file with a font reference to STSong-Light which is not available on the iOS. Therefor I can not display the correct characters defined with that font. I took the STSong font file mentioned on Apples KB: http://support.apple.com/kb/ht1538 … and put it into my project and added it to the plist. The text is now no longer b...

Unknown Crash Reason

I got this crash: "this class is not key value coding-compliant for the key view." And I have no idea what its talking about. Could someone help? ...

How do I resolve link errors that appear in Objective-C++ but not Objective-C?

Hi guys, I'm converting my App Delegate file from .m to .mm (Objective-C to Objective-C++) so that I can access a third-party library written in Objective-C++. In Objective-C, my app delegate builds and runs fine. But when I change the extension, the project builds and I get link errors, all of which are missing symbols from a static li...

Objective c boolean values

Hello, I was wondering what the difference was between the following values in objective c: TRUE(uppercase) - true(lowercase) - yes FALSE(uppercase) - false(lowercase) - no they are colored differently in the IDE, are there different situations when you would use the different boolean values? Thanks ...