objective-c

Objective-C: NSPredicate LIKE doesn't like spaces. Is there an escape sequence to replace blanks with?

I have a NSPredicate that looks like this: NSPredicate *likePredicate3= [NSPredicate predicateWithFormat:@"synonyms LIKE[cd] %@",[NSString stringWithFormat:@"%@", searchText]]; I apply it to an NSArray of objects of a class that has the 'synonyms' property. It works fine when the searchText is a whole word such as "Thanks". However...

Audio Toolbox playback only plays part of output buffers

I'm working on a project which is using Audio Toolbox for recording and playback of PCM data, and I'm having trouble with playback. In the simulator, I can record and play audio just fine, using a custom class to handle storing and sourcing PCM bytes for the recording and playback buffers as needed. On device (iPhone (3.0.1) and iPod 2G ...

iphone storing and then reading a file from Documents folder

this must be easy but I want to put a file in the Documents folder which is read in at start up. I have the code on how to read and have confirmed its looking in the correct directory. However the file I have ,RootList.txt when saved in the Resources folder in xcode, is stored under the Root.app folder and the Documents folder is empty. ...

Drawing a NSImage into NSView subclass

Here's my code so far (in the draw rect): // Drawing code here. NSLog(@"%@", [[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]); NSURL *pathToBGImage = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"NoiseBGMainView" ofType:@"jpg"]]; NSImage *NoiseBGMainView = [[NSImage alloc] initWithConten...

How to increment an NSDate...

I'm trying to implement a method that will increment an NSDate instance variable by one month. I'm having memory management problems with this. (I'm using MallocScribble and NSZombieEnabled, and getting the message: -[CFDate copy]: message sent to deallocated instance 0x3d9dfa0) My question comes down to: what's the best way to incremen...

OS X Data Storage in PLIST Example or Tutorial?

I have looked for several hours for a good tutorial on how to store data for my command line program that I am writing in Objective-C. It seems like my options are NSUserDefaults, Plists, sqlite, or XML. Now, I think at most I'd have 50kb of data to store, retrieve, and modify, so it seems like from what I read Plists would work just f...

Debugging Nested NSCollectionViews

I'm not really sure how to start debugging this issue. I've got an NSCollectionView, whose NSCollectionViewItem prototype view itself contains an NSCollectionView (as well as an NSArrayController, to provide content to this 2nd-level collection view). Both levels of collection view work fine when the top-level view is in the main nib. ...

How to perform a case and diacritic insensitive filter of an array of NSDictionaries (not NSString)?

I have an array of dictionaries. I would like to filter that array by seeing if the @"name" field of each dictionary contains a given string. The catch is that I would like to make my filtering insensitive to case and diacritics. If the array contained only strings I could easily use an NSPredicate. However, it doesn't, and I don't s...

Core Plot causing crash on device but not simulator.

I'm using core plot to create a small plot in one of my view controllers. I have been pulling my hair out trying to track down this error. I install on the simulator and it works fine but as soon as I put it on my device I get the following error: 2010-02-04 22:15:37.394 Achieve[127:207] *** -[NSCFString drawAtPoint:withTextStyle:inCon...

What would be a do nothing operator for a function returning void?

I want to return nothing inside a function returning void. How would I do that? ...

iphone application

Hello I am still learning about iphone application. I want to upload the images which I have taken from iphone camera, to the server database. I have used base64 algorithm for that. The problem is it takes 5 minutes to upload 10 images. So, is there any way to compress it and then convert it into base64, because my server is taking input...

How do you prevent objective-c method execution while waiting for an NSURL connection to finish?

Ok, This may be a very simple question to ask with a very obvious answer but I'm a little stuck on the best way to solve this problem. I am coding an objective-c application using the iPhone SDK. I have some custom objects. These objects execute an NSURL request and send data to a web server, retrieve data back and move on. My problem ...

Referencing view in tabbar app?

I have a tabbar based app and would like to reference one of three views. There are three tabs. When tab2 is clicked, tab2view is created. tab1view needs to reference tab2view so it can be pushed into view. tab2view can be pushed into view via tab2 or tab1view. How do I give tab1view a reference to tab2view? tab1view will also ne...

Trying to remove Super ViewController but stuck in View?

Hello all, I have 3 ViewControllers 1.Main 2.Gallery 3.Text. What my problem is that i have the GalleryViewController using an External UIView with the name GalleryItemView. So once the view controller calls this inside the UIView i have a button that changes the subview so what i do is use the [super addSubView:newView]; eveything work...

sortUsingSelector Not Sorting an NSStrings Array

This is confusing to me. I have a function that does this: void ListAllStoredLocations(NSString *SearchTerm){ NSMutableDictionary *item; NSString* filePath = [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingString:@"/Preferences/yourprogram.plist"]; item = [[[NSMutab...

Share UIWebView between multiple views?

What I'm trying to do is transfer the contents of a UIWebView from one view controller to another. I could just copy the URL and reload the page, but that would take quite a bit of time. Is there any way I could copy the UIWebView instance and then render it on an entirely different view? (I've tried making the UIWebView object on the se...

NSWindow Examples

What are some good NSWindow examples ? I want to start out by writing a simple program that has a window and 2 buttons. Clicking on each button loads a new window in the same view and displays the options. Another option I am considering is a tabbed view where user clicks on tabs and that window loads. I could not find any good tutorial...

Is there really no way to capture the backspace character?

Objective-C is said to accept "\b" as the special character for backspace, how can I capture this in program? My purpose is to catch it in an if-statement to enable me screen characters for my textField: if ([someCharacter isEqualToString:@"\b"]) { } ...

Custom UIView like iCal event "bubbles"

How would I go about creating a custom UIView that is like the event "bubbles" in iCal for iPhone? I would prefer to not use images, so that they could be in any color. Thanks! ...

Is there any way to automatically generate @property and @dynamic tags for Core Data primitive accessors?

Update: mogenerator works, with a template modification The Core Data documentation suggests using the -primitiveValue and -setPrimitiveValue: methods to access and change internal data of an NSManagedObject subclass rather than the slower and non-type-checked -primitiveValueForKey: and setPrimitiveValue:forKey:. I would like to adopt ...