objective-c

Managing several hundred occurrences of NSLocalizedString

My application has several hundred points of localisation, some of which can be reused many times. To prevent from hunting and pecking through code to find occurrences of a particular NSLocalizedString, I create a macro for each in a header file using the #define preprocessor directive. For example: #define kLocFirstString NSLocalizedS...

Adding picture in pickerview

UIImageView *one = [[UIImageView alloc]initWithImage:[[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ball1.png"]]] ; UIImageView *two = [[UIImageView alloc]initWithImage:[[UIImage alloc] initWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathCompon...

Validate NSString

I am validating an NSString to ensure that the string does not contain apostrophes. The code I'm using to do this is NSCharacterSet * invalidNumberSet = [NSCharacterSet characterSetWithCharactersInString:@"'"]; NSScanner * scanner = [NSScanner scannerWithString:string]; NSString * scannerResult; [scanner setCharactersToBeSkipped:nil]...

setting a filename in NSPrintInfo

I'm trying to set up a print dialog, so that if the user tries to save to PDF, it gets a reasonable filename. I currently have: NSPrintInfo* pi = [NSPrintInfo sharedPrintInfo]; NSMutableDictionary *dict = [pi dictionary]; [dict setObject: name forKey: NSPrintSavePath]; [dict setObject: name forKey: @"NSPrintSavePath"]; NSPrintOperation...

How can I parse raw email source and extract the HTML part?

In my iPhone app, I'm handed the raw source of an email, in RFC822 (or "eml") format. I'd like the HTML part of this message (if one exists). Rather than attempting to parse it out myself and converting escape chars and so on, I thought I'd check to see if anyone knows of an objective-c library to do this for me. In .NET, I've always u...

What does this Obj-C "unrecognized selector sent to instance" exception indicate?

What does this mean? * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSPathStore2 hidesBottomBarWhenPushed]: unrecognized selector sent to instance 0x1cd3d0' ...

How to detect if certain characters are at the end of an NSString?

Let's assume I can have the following strings: "hey @john..." "@john, hello" "@john(hello)" I am tokenizing the string to get every word separated by a space: [myString componentsSeparatedByString:@" "]; My array of tokens now contain: @john... @john, @john(hello) I am checking for punctation marks as follows: NSRange textRange...

how to insure MFMailComposeViewController doesnt send mail when body is not empty?

I have MFMailComposeViewController in my app in order to allow the user easily email me about suggestions and feedback on the app but I get about 3 emails a day which are just empty in the body or just the users email signature. Is there any way of checking if the body of an email is not empty before it is sent with MFMailComposeViewCon...

how to send parameters to a web Services via SOAP?

Before I start: I'm programming for Iphone, using objective C. I have already implemented a call to a web service function using NSURLRequest and NSURLConnection and SOAP. The function then returns a XML with the info I need. The code is as follows: NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\...

Several Objective-C objects become Invalid for no reason, sometimes.

- (void)loadLocations { NSString *url = @"<URL to a text file>"; NSStringEncoding enc = NSUTF8StringEncoding; NSString *locationString = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:url] usedEncoding:&enc error:nil]; NSArray *lines = [locationString componentsSeparatedByString:@"\n"]; for (int i=0; i...

Loading a UIView with a UITableView from another NIB

I have a NIB that contains a UIView. I have another NIB that contains a UITableView. How can I load the UITableView NIB inside of the UIView in my other NIB? ...

Objective-c error "-[CFString retain]: message sent to deallocated instance 0x4593540"

Im using phonegap and currently I have a webapp with php and javascript / html running inside of an iframe. It worked for a while but now it crashes with this error when I load the page -[CFString retain]: message sent to deallocated instance 0x4593540 any ideas? thanks ...

Row index of pickerview is not displaying correctly.

I had used images in pickerview. But the row number is not displaying correctly. Anyone please help. I used the below code : - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { NSLog(@"Row : %i",row); return [customPickerArray obje...

UIViewController takes up entire screen in Interface Builder

I have a NIB with a UIView that contains some UILabels, UIButtons etc. and a UIViewController that is loading a UITableView from a detached NIB. I want the UITableView in the UIViewController to be positioned below my UIView, but whenever I add it in Interface Builder it takes up the whole screen, and my UIView becomes part of the UIVie...

Changing text size in Pickerview

How can we change the size of the text in a picker view? Anyone please help. ...

iphone EXC_BAD_ACCESS

I seem to get an EXC_BAD_ACCESS error when I select a cell in my table view that takes me to a 2nd table view with a lot of these http://pastie.org/906711 could they be the problem if I have 8 of them ? Heres the backtrace : http://pastie.org/906729 Thanks for your time, ...

Connecting Multiple Buttons to one action?

Hello, I have multiple UIButtons in my app. I also use interfacebuilder. In my .h i have something like this IBOutlet UIButton *button1; IBOutlet UIButton *button2; IBOutlet UIButton *button3; - (IBAction)buttonPressed; Then In my m i want to do something like this - (IBAction)buttonPressed { if (theButtonIpressed ==...

How to load a NIB inside of a view in another NIB?

I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib contains a UIButton I want ChildViewController.xib to load in the ParentViewController.xib's UIView I have done the following: Created @property for UIView in ParentViewContro...

Integers not properly returned from a property list (plist) array in Objective-C

In summary, I am having a problem where I read what I expect to be an NSNumber from an NSArray contained in a property list and instead of getting a number such as '1', I get what looks to be a memory address (i.e. '61879840'). The numbers are clearly correct in the property list. Anyone know why this may be happening and what I can do ...

Integrating Codeigniter and Objective C

I'm currently building a social networking site using the codeIgniter PHP framework. One of our major focuses of this site is to be able to upload images through the use of smartphones. We were focusing on building for the iPhone, but the iPhone doesn't let you upload files for some reason beyond me. I have been looking through solutions...