objective-c

Property declaration for to-many relationships in Core Data

I have an application written using Core Data. I have 2 entities with a one-to-many relationship. I have subclassed NSManagedObject for both of them. The entity on the one-side is called Playlist and the other is called Song. The interface for Playlist: @interface VBPlaylist : NSManagedObject { } @property (readwrite, copy) NSStrin...

Key Value Observing in Cocoa, introspecting the change property

Hey all, I'm using key value observing on a boolean property an NSObject method: -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context The most interesting part of the value for this key path is a B...

Tab-like-thing with tab-switch animation in a section of UITableView

I have an UITableView with sections in my iPhone application where it looks as something similar to viewing a contact details in standard contacts app. In one of the sections I have a UISegmentedControl set as a header of the section and the items in that section depend on what segment is selected in the segmented control. What I wanted ...

Benchmark UIView drawRect: method

Hi, I am writing an iPhone application in Objective-C that utilizes some custom drawing in views and I would like to benchmark various revisions of my code to see what really helps. I was planing on doing this by setting up a new application, adding my custom drawing code to the drawRect: method of the view, then, in a for loop in the v...

iPhone OS 3.0 Access Clipboard

Hi, I am implementing a custom text editor with syntax highlighting and I would like to integrate it into the OS 3.0 clipboard system. So, my question is, is there a way to programatically set/read the systemwide clipboard? Thanks, Kyle ...

Open Source Card Games or books for Objective-C/Cocoa?

I'm looking for open source projects for card games like Black Jack or Solitaire to get an idea on some GUI/Mac OSX desktop programming. I'm curious if anyone knows of any that're based on Objective-C/Cocoa that I can read/learn from? ...

Use an object after it has been released?

I am going through Cocoa Programming for Mac OS X by Aaron Hillegrass and have come to something I do not understand. On page 150-151 he creates an object, releases it, and then uses it again. For example: - (void) someMethod { NSMutableArray *array = [[NSMutableArray alloc] init]; NSString *str = [[NSString alloc] initWithStrin...

Can someone explain these errors to me?

Im getting these weird errors, but I dont understand them. Here are the errors: error: variable - sized object may not be initialized (#1) error: statically allocated instance of Objective-C class 'Joke' (#1) error: statically allocated instance of Objective-C class 'Joke' (#1) error: cannot convert to a pointer type ...

Learning Objective C without a Mac

I do not have a Mac, or an iPhone. However, the concept of taking C and making it more dynamic towards the idea of smalltalk, python or ruby is really attractive to me. I'd love to start on objective C. Is objective C just a syntax superset of C or is it really like C. As in, can it be compiled with gcc etc..? I do most of my program...

integerForKey always crashes app

Retrieving a value from standardUserDefaults using integerForKey after saving with setInteger:forKey always crashes app. If I retrieve value using objectForKey and cast value to int, there are no errors and I can display value in a log message fine. However, when I attempt to assign that int to another int or try to perform a math func...

How do I create a page flip effect programmatically?

I'm pretty sure I can create a page flip effect using a series of PNGs to simulate the animation but is there a way to do it programmatically? Tried googling it and looking at Apple sample code but didn't see anything addressing that particular animation. ...

One instance across multiple views

I was wondering how I would go about accessing one instance of a class, say "ship class" across multiple views. Lets say I have a rootViewController and three subviews, one Main, one battle, and one landing. Where exactly would I implement an instance of a class that stores all the information on my ship and access it though the other v...

iphone development

Hello,I am still new in objective-c. I want to create an application on iphone in which I take a data from XML using NSXMLParser. so when I start the application It will read the XML and data are coming from that,but in between in running appliaction if the XML is updated then how can my application know about it and get that refreash da...

How would you add a Group Feature like iChat's to your Core Data App?

I am Developing A Core Data App, and would like to add a feature like the Groups feature in iChat to my App. The Feature would be displayed in the table with normal table rows and more groups could be created. Other rows of the table could be dragged into the Group and the Group could be collapsed and opened. What code would I need to do...

Populate an NSTokenField with tokens from a container of objects

I have an NSTableView and an NSTokenField in a window. I have implemented the following delegate methods: tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: tokenField:representedObjectForEditingString: tokenField:displayStringForRepresentedObject: I want to make it so that when a row is selected in it, the NSTokenF...

how can i configur AD Hoc distribution for a iphone application?

how can i create AD Hoc distribution for my iphone product. ...

Having trouble adding objects to NSMutableArray in Objective C.

I am using the iPhone SDK and have an issue doing something simple. I am trying to add an NSNumber object to an NSMutableArray instance variable. I tried adding NSNumber card to NSMutableArray viewedCardsArray, however without breaking, it does not get added to the array. Here is the code. //////////////////////////////////////////////...

After masking Image looks blur

Hi to all, I am developing one game where I want to magnify the image where magnifier image is placed. For that I am using the concept of masking. After masking I am zooming the image but looks blur. And I want image should be clearer like we r looking through rifle magnifier. So if any one have solution then kindly reply ...

Delegate methods of NSTextField using NSNotification

I have an NSTokenField in a window. I am using it to store tags related to a Core Data object. Right now I have it set up such that I can add tags to the objects, but I cannot delete them. I need a delegate method on the NSTokenField that can let me know when the user has moved the focus out of the NSTokenField. Since NSTokenField is...

How do I convert Cocoa co-ords from top left == origin to bottom left == origin

I use CGWindowListCopyWindowInfo to get a list of all windows. It gives me the co-ordinates of each window based upon the origin being the top-left of the screen. If I use NSWindow's setFrame method, the co-ordinates on based upon the origin being the bottom-left of the screen. What's a clean, reliable way to convert from one to the ot...