cocoa

Make UITableView selection before view appears

I'm building a detail view for a UITableView. The detail view contains a UITableView which has two rows, and I want the first one to be selected when the detail view is opened. I have tried to use the method [selectRowAtIndexPath:animated:scrollPosition] in [viewWillAppear]: - (void) viewWillAppear:(BOOL)animated { [[self tableView]...

How can I keep multiple NSManagedContext's in sync?

I've spent a couple of hours tonight trying to create a setup whereby I have three managed object contexts - one attached to my application's delegate, one in an NSObject subclass responsible for UITableView updates (via an NSFetchedResultsController) and one in an NSOperation subclass. I can get the changes from the NSOperation subclas...

Design philosophy for iPhoto and Aperture export plugins

I need to design a plugin architecture similar iPhoto and Aperture's export plugins, but I'm puzzling over the design pattern that Apple used. I hoping somebody could help shed some light on the advantages to the approach taken by Apple. The pattern that Apple uses for both programs is to have an ExportManager of sorts that the plugin q...

How to determine smallest height of vertical scrollbar?

Other then creating a dummy NSScroller and incrementally decreasing it's height until usableParts returns 0, is there any easy way to determine what the minimum height of a vertical scrollbar should be so that usableParts will not return NSNoScrollerParts? What I need to be able to do is limit the height of my window based, in part, on ...

Methods from @synthesize?

When you synthesize a property (see below) @interface CelestialBody : NSObject { NSString *name; } ... @interface Planet : NSObject { NSString *name; int mass; CelestialBody *moon; } @property(nonatomic, retain) NSString *name; @property(assign) int *mass; @property(nonatomic, retain) CelestialBody *moon; ... @implemen...

UITableViewCell displaying incorrect alpha based background colors

I have a UITableViewCell with the UITableViewStyleGrouped style and I would like to change the background color of the cell. - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)ip { // Do cell creation stuff ... cell.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:243.0/255.0 b...

Debugging with NSZombieEnabled

Hi, I have been tracing a BAD_ACCESS error using NSZombieEnabled. As error I get returned: *** -[MyDocument respondsToSelector:]: message sent to deallocated instance 0x2671b0 I do know what this means,however what surprises me is that I don't call this function anywhere, not in MyDocument.m nor in any imported files.To be exact, I d...

UIButton currentTitle displaying different information that expected

I have the following piece of code - (IBAction)buttonPressed: (id) sender { UIButton *button = (UIButton*) sender; NSLog(@"Clicked button is: %d", button.currentTitle); } The output is: Clicked button is: 26317696 Why is not displaying the title of the button which is "A"? ...

What steps should be taken to convert my XML into Core Data objects?

Hi all, I have an XML file which contains lists of stores, a simplified version is below. What I would like help with is some high-level ideas on the simplest ways to move this data into objects for storage in Core Data. I see suggestions around key-value pairs but as you can see in my example below, I have child elements with the same...

What is the KVC Search Pattern for mutableArrayValueForKey?

Hello! I'm attempting to understand Cocoa's Key-Value Coding (KVC) mechanism a little better. I've read Apple's Key-Value Programming Guide but am still a little confused about how certain KVC methods search for keys. Particularly, mutableArrayValueForKey:. Below I'm going to explain how I understand valueForKey: KVC "getters" to wor...

NSTextView doesn't initialize when I call readFromData:(NSData *)data ofType:(NSString*)string

I have a refreshDisplay: method that calls the setString: method of an NSTextView. I can save, and load, but when I load even though my program loads the data, it does not display it on the NSTextView as it should. I did a check and that NSTextView seems to be nil when I load, which is why the setString: method does not do anything to it...

WebView mainFrame method returns nil

I have the following code in a window controller as part of a singleton special web browser + (id)sharedPurchaseController { static SomeController *sharedController = nil; if (!sharedController) { sharedController = [[SomeController alloc] initWithWindowNibName:@"anXIB"]; } return sharedController; } - (void)a...

UIpicker scrolling sound

I getting mad doing the research for the solution of this method. I want to control or disable the clicking sound whenever the picker is scrolled. now i want to use the documented one. Can you help me solve this at the range of 1 day? please I really need to do this as fast as i could. But I guess you can give me some hint to solve this ...

Organization of many bundles (like System Preferences.app)

I'm working on a project which organizes many separate bundles onto a System Preferences-like screen, in categories. First, how does System Preferences organize its pref panes into categories? A quick glance in the pref panes' bundles reveals no obvious category info. Second, how should I organize my bundles into categories? Right now,...

3D Rotation of Object

hi all, I am trying to rotate my object like shakes dice. please suggest simplest way to implement it in my iphone application. Any kind of sample code or documentation. thanks deepika ...

Launching help page in Help Viewer in 10.6

I launch help file in 10.4 and 10.5 using AHGotoPage which work great. When I try launching in 10.6 I get error "hVURLHandlerErrorDomain error 1003" but no idea why. Note: The error is only on Release version not in Debug. I even tried with AHLookupAnchor, even this gives the error. Am I missing some thing in solution? Is there any ot...

NSURLConnection performance

Hi all, I'm using NSURLConnection for downloading some images in my app currently. Before implementing via this, I implemented it by NSData(dataWithContentOfURL) in NSThread. But I wanted to cancel during downloading images, So I changed it to NSURLConnection. But It happens other problem. Performance was very low after changing. For ...

Shared Model on Mac and iPhone

I'm currently looking into unifying the model of my application. At the moment I'm using a different model on the mac/iphone. Missing classes (NSAttributedString) and missing technologies (Bindings) made me go with this decision. With the first restriction gone in SDK 3.2 and my plan to also create an optimized iPad version I'm reconsid...

Problem in adding static library in cocoa application

Hi, I am having liavcodec.a static library and header files of this library. libavcodec.a I added this library and their header files into my project and there is no error. I can see this library added in Target->Info->General and i have edited the Header Search Path also. I can add header file #import “avcodec.h” into xcode project ...

Existing Objective-C library for dealing with human readability (and based on Cocoa's Foundation framework) ?

Is there an existing Objective-C library for dealing with human readability of object counts, file sizes, dates, time durations and so on? (and based on Cocoa's Foundation framework?) In other words, given an NSDate, NSNumber, NSTimeInterval etc. or an NSArray of objects; is there a library for constructing a string representation that ...