I'm storing text in a sqlite file and setting the text of a UITextView to be the value of that text. The only problem is that the UITextView isn't honoring the newline character. Instead, it's printing it out as text. Here's an example:
Stored in fruit.sqlite and passed to theFruit object:
requiredFruit = "apples\n oranges\n pears"
...
I'm getting a string from a server call, and Trying to set that string to the value of the text in a UITextField. However, if the text has any special characters, the encoding gets screwed up on those characters.
-(void)contentDidLoad:(NSString *)content
{
NSLog(@" content being put into textfield is : %@", content);
self.textF...
Hey, I am trying to convert NSString to a C string using cStringUsingEncoding but I have a memory leak. My understanding is that cStringUsingEncoding returns a pointer to a character array that is only guaranteed to exist for the duration of the NSString object. As such you should copy its contents to another string. Here's where my prob...
I am attempting to work on an app that highlights certain key words. For this reason, I am looking at using either CoreText or UIStringDrawing to highlight these words (As in bold/underline/italicize/color) since UITextView doesn't seem to have these facilities (And I haven't had any luck with CATextLayer).
In either case I am able to s...
Hi
My application generates loads of images and in order to save memory, I write these files to the temporary directory and read them when needed. I write two versions of the same image to the tmp folder one the thumbnail version at lower resolution and the other is full size. To make the file names unpredictable, I add a string hash at...
I'm using a text file to save the changes made by a user on a list (the reason that I'm doing this is so that I can upload the text file to a PC later on, and from there insert it into an Excel spreadsheet). I have 3 data structures: A NSMutableArray of keys, and a NSMutableDictionary who's key values are MSMutableArrays of NSStrings.
...
Hi All,
So I am trying to retrieve data from an XML stream coming from a URL. This URL is configured on a search string the user inputs. Is there any reason why this code should not be working?
NSString *searchString = "Geoff";
NSString *updatedURL = [NSString stringWithFormat:@"http://mysearchpage.com/searchQuery=%@", searchString]...
Hi all,
I'm trying to set the date of a UIDatePicker but I the month is everytime "January"(01). I tryed to use "MM" and "LL", but both of them are not working.
My code:
-(void)viewDidLoad {
[super viewDidLoad];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"YYYY-MM-DD"];;
...
I have a plist where I place my strings, with type string.
When I access the strings in the plist, it doesnt interpret \n and \t.
So when I display these strings it will display \tTitle
and not Title with tab indention.
But if I use
#define str1 @"\tTitle"
and just place it in header files, it works.
Please help.
...
Hello,
I am using UIViewController (a subclass of course) with a text field which sends an action when the contents changed (to the contentsChanged: selector of the ViewController). It is done by sending contentsChanged: to file's owner in IB.
But when I test it, it says : "-[NSCFString contentsChanged:] : unrecognised selector sent to i...
Here is my code snippit:
- (void) getData: (NSNotification *)aNotification{
NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem];
if ([data length])
{
return [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
} else {
[self stopProcess];
}
[[aNotification objec...
I have to access a web server using a GET with international characters (Hebrew in my case but could be anything).
So I make an NSString just fine but
[NSURL URLWithString:urlString];
return nil.
I realize I probably have to convert the international characters to percent codes.
Is there a built in method in Objective-c to do so?
...
I am trying to get the width of an NSString (ex. NSString *myString = @"hello"). Is there a way to do this?
Thanks.
...
Hello. I'm diving into iOS development and the Objective C language and am building an alarm clock app to become familiar with the SDK and language. I have an NSString object that represents a time, with the range "1:00 am" to "12:59 am". I need to convert this NSString into two NSInteger's that contain the hour value and minute value...
I'm trying to compare the equality of two multi-line strings. I'm getting one of the strings from a web service, and the other I'm getting from iTunes via the Scripting Bridge. The strings from the web service are eventually transferred to iTunes, so if I do that and then re-compare the strings, ideally they'd be identical.
However, w...
Hi there,
I'm turning around and around with the following code giving me a memroy leak in the pics object apparently linke to the object imageName.
for (int i = 0;i<[potatoesIndexesArray count];i++){
int imageNumber = [[potatoesIndexesArray objectAtIndex:i]intValue];
NSString *imageName = [[NSString alloc] initWithFormat:@"...
How do you test if an NSString is empty? or all whitespace or nil? with a single method call?
...
So I have this:
NSData *charlieSendData = [[charlieImputText stringValue] dataUsingEncoding:NSUTF8StringEncoding];
I know how to convert NSStrings to data but how I convert data back to an NSString?
Elijah
...
I have an app that parses an XML doc & pulls out the info it needs. There are often a few matching items so the code iterates a few times. Instruments' Leaks tool keeps saying there is a leak on this line,
self.currentDiscountedPrice = [parsedCharacters substringToIndex:(fullStopRange.location + 3)];
currentDiscountedPrice is a var de...
Just a simple question on NSStrings, I have a piece of code that assigns a value to a string, depending on what is found it is either assigned a value by substringToIndex or the constant string @"0.00", is it okay to use
// Save if value found, otherwise set to 0.00
if (parsedCharacters == nil || [parsedCharacters isEqualToString:@""])
...