objective-c

Converting from RGB to HSL with Objective C

I'm quite new to objective c but have been programming for a while. I started creating a function that would convert from RGB to HSL and back again but I get a feeling it is way too long and headed in the wrong direction. Does anyone know of a simple way to perform this conversion? ...

iPhone SQLite Password Field Encryption

Good Afternoon Guys and Girls, Hopefully this will be a quick and easy question. I am building an App that requires the user to input their login details for an online service that it links to. Multiple login details can be added and saved as the user may have several accounts that they would like to switch between. These details will...

How can I set an int value in some code to be equal to a value in a text entry box?

I'm trying to get a value from an object in my mac application. The title says it all. ...

Detect when a Mac OS X window is resized or moved

I am writting an application which must know when a window is resized or moved. I had a look on notifications but it seems it does not do what I expected. Do you have any idea how I can achieve this? ...

Objective-C: Scope problems cellForRowAtIndexPath

Update: It seems to be a problem with the scope of the "results." titleForHeaderInSection seems to be unaware of the "results" arrays content. Will post once I find a solution just in case anyone stumbles across this with the same problem. How would I set each individual row in cellForRowAtIndexPath to the results of an array populated...

Benchmarking a particular method in Objective-C

I have a critical method in an Objective-C application that I need to optimize as much as possible. I first need to take some easy benchmarks on this one single method so I can compare my progress as I optimize. What is the easiest way to track the execution time of a given method in, say, milliseconds, and print that to console. ...

Obj-c method override/polymorphism problem

Ok, so I'm using Objective-C. Now, say I have: TopClass : NSObject - (int) getVal {return 1;} MidClass : TopClass - (int) getVal {return 2;} BotClass : MidClass - (int) getVal {return 3;} I then put objects of each type into an NSMutableArray and take one out. What I want to do is run the getVal func on the appropriate object type, ...

Retrieve names of running processes

Hi everyone, First off, I know that similar questions have been asked, but the answers provided haven't been very helpful so far (they all recommend one of the following options). I have a user application that needs to determine if a particular process is running. Here's what I know about the process: The name The user (root) It sh...

when to use "willChangeValueForKey" and "didChangeValueForKey"?

I saw these lines in a demo project, but I couldn't understand why it did that. [self willChangeValueForKey:@"names"]; [self didChangeValueForKey:@"names"]; It called didChangeValueForKey immediately after willChangeeValueForKey. Does it make any sense? Furthermore, when should be the right time to call this two methods? Thanks a lo...

Great UIKit/Objective-C code snippets

New to Objective-C iPhone/iPod touch/iPad development, but I'm starting to discover lots of power in one-liners of code such as this: [UIApplication sharedApplication].applicationIconBadgeNumber = 10; Which will display that distinctive red notification badge on your app iphone with the number 10. Please share you favorite one or two...

get data from online once and then viewable offline

Okay, I want to have an app that takes phone numbers from an online database and displays them in a table view. When the user is not online, I want them to still be able to see the numbers they already got from the database in the table view. If the user manages to go back online, the database updates the view. My question is, is this po...

Creating simple waveforms with CoreAudio

I am new to CoreAudio, and I would like to output a simple sine wave and square wave with a given frequency and amplitude through the speakers using CA. I don't want to use sound files as I want to synthesize the sound. What do I need to do this? And can you give me an example or tutorial? Thanks. ...

Obj-C: calling release/dealloc causes EXC_BAD_ACCESS

Here is my custom class: PolygonShape : NSObject { int numberOfSides; int minimumNumberOfSides; int maximumNumberOfSides; } My custom init method: - (id)initWithNumberOfSides:(int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max { if (self = [super init]) { [self setMinimumNumberOfSides:min]; [self setMaximu...

Can I learn the iPhone SDK and complete an app by September?

Hi everyone, I'm wondering if it's realistically possible to learn the iPhone SDK and complete an app by the end of this summer. The app shouldn't be too difficult, it would just interact with my site's API and essentially just fetch, create, and edit resources. I already have a little experience with the SDK (and I'm comfortable with Ob...

How can I launch QuickTime from my app?

I am trying to load a video from the web, but am having trouble getting it to appear in QuickTime. I can only hear the audio. I would like it to launch QuickTime. - (void)loadView { NSURL *movieURL = [NSURL URLWithString:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"]; if ...

Most efficient way to download media files from a server from within an iPhone app.

Hi, I have an iPhone application which contains a lot of media files, so far we have been able to keep the size of the iPhone app to less than 20 MB. We add new content with new updates, it would be difficult to keep the app size within the 20 MB limit. The right thing to do here would be to fetch the files on demand from a media/web s...

iphone accessing or modifying properties of objects in an array

How would I access the properties of an object stored in an array? something like: [myArray objectAtIndex:0].intProperty = 12345; ...

Obj C - how to customise the interval between slides with IKSlideShow

I'm very new to Objective-C and Cocoa but I've made a simple app which uses ImageKit to present a slideshow using the IKSlideShow class. However I've got a bit stuck with something I thought would be simple. I want to increase the time photos are displayed on screen when the slideshow is playing, but I can't see how to do it effectively....

CGFloat argument type incorrectly traces out with zero value...why?

Hi Really puzzled why the following is happening and hope someone can help. // here xPos correctly traces out, always changing //CODE EXCERPT CGFloat xPos=currentTouchPosition.x - lastTouch.x; NSLog(@"touchesMoved and xPos= %f", xPos); if (startTouchPosition.x < currentTouchPosition.x) [self adjustTimer:xPos]; else ...

Whats the maximum key length in NSDictionary?

Hey there, I'm currently working on an app which displays a bunch of files in a table, and you can add and remove them and whatsoever. To prevent duplicates in the table, I'd like to create a NSDictionary using the files full path as keys for another NSDictionary which contains all the file information, but I am a little concerned about...