objective-c

Removing titlebar from 'Utility Application's flipside view

I've put a table on the flipside of my Utility Application template. The template automatically puts a titlebar with a done button to go back to the front view. When one of the cells in the flipside's table is selected, it brings up the Camera / Image Library picker. But it leaves the titlebar is position, partially obscuring the picker...

Remove white backgrounds from images

Hello, I have some product photos, from which I would like to remove the white background. An example: Is there a nice library or a manual way to do it with Cocoa or C? For which keywords (image processing methods) do I have to search? ...

Basic HTTP Authentication on iPhone

Hello, I'm trying to get a small twitter client running and I ran into a problem when testing API calls that require authentication. My password has special characters in it, so when I try to use the following code it doesn't work. NSString *post = [NSString stringWithFormat:@"status=%@", [status stringByAddingPercentEscapesUsingEncod...

NSOutlineView not doing what it has should do in it's subclass.

I have created a Sub-Class of NSOutlineView and used the below code to make the row colors alternate. Header File. #import <Cocoa/Cocoa.h> @interface MyOutlineView : NSOutlineView { } - (void) drawStripesInRect:(NSRect)clipRect; @end Implementation File. #import "MyOutlineView.h" // RGB values for stripe color (light blue) #def...

iphone assigning instance variables

I just spent the last 3 hours trying to figure out this error. I would like someone to explain it to me so I don't do it again. I assigned an NSString instance variable without using "self". When the class ("self") released, I received a "bad access" error. I have done this exact same thing in another class with the same variable dec...

Giving The Root Row Of An Outline View A Different Background Color.

I have some code to do this (which is below) but I get one error stopping it from working and the error is ''MyOutlineView' may not respond to '-objectArray'', it says that it needs to be declared but I don't know what code I should use in the Header File to declare it. The Code: - (void) outlineView: (NSOutlineView *) aView willDispla...

stringWithContentsOfURL and HTTP 500 error codes

I am trying to pull some data from a server (I don't own the server) however it returns some needed data with a http 500 error code, however NSString stringWithContentsOfURL returns nil if the server returns http code 500. I'd like to retrieve the data even if the server returns 500. ...

Update results of NSFetchedResultsController without a new fetch

I'm working on an application that holds its data in an external MySQL server, but caches it locally using Core Data for better response times. Basically, what I'd like to do is this: Fetch data from Core Data (SQLite data store, using NSFetchedResultsController) and display it Grab new items from the MySQL server in the background Ref...

NSMutableArray - Query items without enumeration?

Using LINQ in .Net I can select items from an array that match a particular criteria i.e. from an array called People: var cleverPeople = People.Where(o=>o.IQ>110); Is there anything similar I can do to an NSMutableArray? I have many items in it and enumerating it with a loop is pretty costly performance wise. ...

Date picker + Segmented control + some labels

Hi Guys, Here is how the page should look like: It should have the following functionality: - By clicking the period on segmented control start date gets the value of present time - the interva and end date gets the value of the present time. - By selecting one of the labels Start/End, you are able to change their date with date pi...

non-XCode IDE for Cocoa?

I think Xcode is a good IDE, but having used Eclipse for Java development in the past I am quite underwhelmed by XCode's code completion and error/warning feedback. (Most of the time, XCode seems to simply try to match the beginning of a text fragment to "words" in the same document, without even using type information to try to determin...

Objective C NSString problem

I have a NSString that I need to examine character by character and: examine char perform calculation loop (until string ends) Any thoughts on the best way to do this? Do I need to convert the NSString to a NSArray or C string? ...

How to implement or modify method dispatch table in Objective-C?

Occasionally, it's useful to set up method dispatch table so calling method A calls AImpl() method while calling method A at another time calls BImpl(). How can this be done in Objective-C for a method that's automatically called by the system (e.g. delegate methods)? For example, if the sytem calls viewDidAppear for the first time, I ...

Objective-C implementation of a histogram or bag datastructure

Instead of implementing my own I was wondering if anyone knows of a histogram or bag datastructure implementation in Objective-C that I can use. Essentially a histogram is a hashmap of lists where the lists contain values that relate to their hash entry. A good example is a histogram of supermarket items where you place each group of it...

Objective C unicode character comparisons

How are unicode comparisons coded? I need to test exactly as below, checking for specific letters in a string. The code below chokes: warning: comparison between pointer and integer for (charIndex = 0; charIndex < [myString length]; charIndex++) { unichar testChar = [myString characterAtIndex:charIndex]; if (testChar == "A") ...

Understanding Objective-C's dynamic runtime

I'm getting my feet wet in Objective-C and Cocoa (I know, probably late, but hey I have to start somewhere) and I noticed that all objects are allocated out of the heap. Is there any reason why this is the standard in Objective-C? I tried looked everywhere (and yes, even on StackOverflow), but I couldn't find any explicit reason, except...

Convert NSString to NSDictionary

Is there a way to get an NSDictionary back from the string created via its description method? Given this code: NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"value 1", @"value 2", nil] forKeys:[NSArray arrayWithObjects:@"key 1", @"key 2", nil]]; NSString *dictionaryString = [dictionary descr...

In ObjectiveC, are pointers that are class instance variables initialised to 'nil', or otherwise?

I.e., does ObjectiveC behave like C, in that if you create a pointer eg: NSString* c; Does c point to nil, or to the random value in the memory area that was reserved for it? In other words, do pointers get pre-initialized, or do I need to do that myself? As I said, I'm aware this is not the case in C/C++, but I'm wondering if ther...

NSString stringWithContentsOfFile failing with what seems to be the wrong error code

Hello. I'm trying to load a file into a string. Here is the code I'm using: NSError *error = nil; NSString *fullPath = [[NSBundle mainBundle] pathForResource:filename ofType:@"html"]; NSString *text = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:&error]; When passed in @"about" as the filename, it w...

Passing variables in objective C

Normally i've been passing variable around in init methods, but I can't do that this time because I have a var in one ViewController class displayed using a tab bar and I need access to it from a different ViewController class when a different tab bar is pressed. My understanding was that you can access vars using @property but it's now ...