objective-c

Intercepting all touch events

I have a UIViewController inside of a navigation based app. I'd like the view controller to receive all touch events from child objects, such as a tableview and navigation bar. Or, any other technique that is able to intercept all touch events. Right now, the following never executes inside of the view controller: - (void)touchesE...

Is fast enumeration considered bad form or is it generally accepted?

Just wondering, it seems like it works pretty well but I want to make sure I am using generally accepted coding practices and not get into bad habits. Thanks, Nick ...

Objective-C / iPhone IRC Library

Is there a IRC library that is suitable for use on the iPhone? ...

Accessing recipients, body etc in an MFMailComposeViewController

I'm currently working on persisting the UI state of my iPhone app across launches, but it's proving to be a bit of an issue in one of my controllers - a sub-classed MFMailComposeViewController. Essentially, I need to store (on app exit) the current To/CC/BCC lists, the subject, and the body so I can set the view up again after a relaunc...

Why my ABPersonViewController not showing all the properties?

Why my ABPersonViewController is not showing all the properties? Currently it is showing only phone number properties. It is not the e-mail ids, addresses, birth day and other info. My contact has all this info. How the Phonebook's/Contact's ABPersonViewController is showing all this info? And How can I get the "Text Message", "Share Con...

Compile Error with: switch, "expected expression before"

Hello, Cut to the chase I have recreated my problem as it is fairly self explanatory. this complies without error: switch (n) { case 1: NSLog(@""); NSString *aStr; break; default: break; } this compiles with error and it's only missing the NSLog(): switch (n) { case 1: NSStri...

IPhone app with SSL client certs

I'm building an iphone app that needs to access a web service over https using client certificates. If I put the client cert (in pkcs12 format) in the app bundle, I'm able to load it into the app and make the https call (largely thanks to stackoverflow.com). However, I need a way to distribute the app without any certs and leave it to ...

Problem with accessing variables/functions from subclass Objective C

Hi, I am having a problem with accessing public variable 'activity', which is a UIActivityIndicatorView type, see class declaration below in QuickStartViewController.h: @interface QuickStartViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate> { @public IBOutlet UIActivityIndicatorView *activity; } @property (...

Reorder-able UITableView with Max # of Rows per Section

Hi guys, first off, I'd like to say that this is my first time posting on StackOverflow. I'm new to iPhone dev and programming in general, having recently completed Stephen Kochan's Programming in Objective-C 2.0, and parts of Erica Sadun's iPhone Cookbook. Just reading answered questions on this site has helped me a lot, so I owe a big ...

sortedArrayUsing and NSComparison Result : I don't understand how these are actually going about sorting

We're looking at different methods to sort the objects/elements in an array, the thing that doesn't make sense to me is how the actual sorting is done. I guess the big point of confusion is how can the "sort" method be effective if it only compares one object against another? If there are values a, g, b, d, z, s, h in the array im not ...

Confused With This Math Answer Using Double Type Variable

This is really weird, hopefully a fresh pair of eyes can help me figure this out. I happen to be using this code in an iPhone App, but I believe it's using simple C code so not sure this makes a difference or not. I have the user input a number (in this case the num will be 2.2). I then divide that number by 0.2. On my calculator I get...

Determining Length of Double Type Variable in C

I am using the following code to come up with a number. NSString *userNameOne = txtUserName.text; double numOne = [userNameOne intValue]; double agedecade = numOne/10; double betaage = 0.23260; double meanage = 5.64301; double one_age = agedecade - meanage; double age_final_var = one_age * betaage; If the user input 55 into the num...

Executing cleanup code?

Generally speaking goto is bad (we all know why) What would be a better way to implement a simple cleanup on an error (as in the example below) without having to duplicate the code. To my mind the code below is fine, I was just curious what others would do: int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAu...

arrayWithObjects: Objects should be NSStrings

Hi, maybe it is just to late or I´m to stupid, but I can´t solve this problem. I use this code to file the rows in my UIPickerView: self.component1Data = [NSArray arrayWithObjects: @"Sample", @"Sample1", @"...", nil]; How can I get a NSString instead of the "sample"? I tried it with "%@" but it doesn't work: self.component1Data = [N...

refreshing NSTableView with new data multiple times

Hi, I have an NSMutableArray and I load my tableview from it. Now I have a Button in the UI which kinda lets the user refresh the data that goes into the array multiple times. And everytime there is new data in the Array I want to refresh the tableView. Just doing [tableView reloadData] after updating the array seems to bring up the be...

Can´t pass a NSString from one view to an other view

Hello, I try to pass a NSString from one view to an other view, but I doesn't work. I set a NSString in the SecondViewController as property @property (assign) NSString * wert1; When I load the SecondViewController with a button-press on the FirstViewController, I try to pass the NSString: SecondViewController *Second = [[SpinViewCon...

What is the "stringWithContentsOfURL" replacement for objective C?

I found a tutorial on the net that uses the stringWithContentsOfURL command that is now deprecated as of iPhone OS 3.0. However I can't find out what I'm meant to use instead, and how to implement it. Below is the code surrounding the stringWithContentsOfURL line in case you need it for reference. NSString *urlString = [NSString string...

Can you alloc an object whose parent class uses the autorelease pool?

I have a subclass that i use alloc and init to instantiate. In the init method I go self = [self initWithRect:spriteManager.imageRect spriteManager:spriteManager.manager]; So the parent constructor is using the autorelease pool. So what happens here? If I try to release the object I get an error. Should I change my init method to...

Inheritance in Objective-c and Functions

I have class X, an abstract class, and classes A and B that inherit from it. Classes A and B each have their own 'return_something' function. I have another method elsewhere that calls 'return_something' on a series of objects, all of type X. 'return_something' returns something different depending on whether it is an A or a B, so I c...

Character replace in String from database (Objective-C)

Hi, I have a UITableView and each row I cliked display a UIViewController containing information store in my database like this: [self.myViewController.myViewControllerDescription setText:[self.fiche description]]; The information store in the database contains HTML syntaxe ( < BR > ) and I display them in a UITextView (as you know ...