cocoa

UISlider in Cocoa

In a Cocoa app I added a UISlider. If I run the program without adding any code then I can drag the slider left and right. However, if I assign an IBOutlet to it, once I touch the slider, the application exits. Why is that? ...

Cocoa: saving numbered list as webarchive causes indenting problem

SUMMARY Create a numbered list in a NSTextView Programmatically scale the text larger (by adjusting the NSFont for the attributed string) Save the attributed string as a webarchive When the resulting webarchive is opened in a web view, the numbers in the list appear partially off the screen (to the left). This only happens if the tex...

resizing a subview and having superviews / window resize

My window is structured like so: NSWindow -> NSView -> NSTabView -> NSScrollView -> NSTextView. If I change the size of the NSScrollView with setFrameSize: the superviews / window do not resize to accommodate my larger or smaller NSScrollView. Is it possible to programmatically have the Window, etc. automatically resize when I set the si...

popup menu calling for update of all menus on each keypress

I'm creating a pop up menu programmatically and updating it with the delegate method menuNeedsUpdate:(NSMenu *) menu and then displaying it using the popUpMenuPositioningItem:nil atLocation:mouseLoc inView:nil method. It works fine as far as mouse control is concerned. However, when using the keyboard (letters or arrow keys), I've notic...

Refreshing an NSTableView with modified contents of NSMutableDictionary

I have a NSDictionaryController whose content is bound to a NSMutableDictionary, both initialized and connected in Interface Builder. After a certain IBAction is called, the contents of the dictionary are programmatically modified. The NSTableView, which is hooked up with Cocoa bindings to the NSDictionaryController, does not get updat...

Mac Programming: Command-TAB - How does this build the application list?

I have a need to enumerate the applications that have "windows", "icons", whether if they are minimized to the dock or not. I need basically the list of applications that Command-TAB brings you. How do you do this programmatically? Everything I tried gave me everything, or just the applications that are NOT minimized. Drives me nuts. T...

Cached iTunes Cover Art

Hi, I need to fetch cached cover art from iTunes. Currently I'm working with the scripting bridge, but it only fetches covers that are embedded in the tracks. I've also tried this method here http://stackoverflow.com/questions/1433035/fetch-itunes-album-artwork-without-itunes-running but it seems to be broken (at least in iTunes 9.2)...

display image cell in tableview

I tried to display imagecells in tableview, but the program crashes.. here's my imageCell class: @interface ImageCell : NSTextFieldCell { NSImage *imageIcon; NSString *labelStr; } @property (retain) NSImage *imageIcon; @property (retain) NSString *labelStr; - (id) initWithLabel:(NSString *) labelString imageName:(NSString *) i...

Why does an autoreleased NSTask block the runloop on an NSOperation thread indefinitely?

I've run into an while trying to launch an NSTask from inside an NSOperation. Here's a very simple app I've put together to showcase the problem. When you click the button, an NSOperation is queued. It sets up an NSRunLoop, and calls a method which invokes an NSTask. The task is really simple- it just launches /bin/sleep for two seconds...

Cocoa-Touch - Loading a text file into an array

Whats wrong with my code.. I want it to read a text file like Item1 Item2 Item3 Item4 Item5 and parse it into an array so each line is a separate object in thus array. When you check the console it prints (null) -(void)parseIntoArray{ //parse the files into seprate arrays. allPools = [[NSMutableArray alloc] initWithContentsO...

Efficiently keep records of each change to some Core Data relationships

I'm designing a Core Data app which needs to keep dated records. Imagine a user works with the program for a while and some records are stored. The user then changes important attributes and relationships (which transcend individual records), and continues using the program with this new configuration. Imagine now that the user looks ba...

Can an inherited @property not satisfy a <protocol> @property?

I've got a protocol: @protocol Gadget <NSObject> @property (readonly) UIView *view; - (void) attachViewToParent:(UIView *)parentView; @end And an "abstract" base class, with an implementation (as a getter, not shown) of -(UIView *)view: // Base functionality @interface AbstractGadget : NSObject { UIView *view; } @property (re...

Objective-C property reference count

Could someone please help me understand reference counting in Objective C properties. Suppose I have class @interface TA : NSObject { TB* tb; } - (id) init; - (void) dealloc; @property (nonatomic,retain) TB* tb; @end @implementation @synthesize tb; - (id) init {...} - (void) dealloc {...} @end My understanding is that assignment...

iPad Keyboard: mode based key augmentation

When using the "add Account..." function in the 'Mail,Contacts, Calendars' section in 'Settings' on an ipad, selecting the address field causes the keyboard to change the labels of the '!,' and '?.' keys, shorten the right '.?123' and space key and add two new keys ('_' and '-') I have also seen the Keyboard augment to show a '.com' key...

How force NSMenuItem to redraw?

Hi, I'm implementing a custom status bar menu, which has a custom view with NSSearchField. I'm updating number of menu items according to search results. The number of menu items is changed as user types in the NSSearchField. I've noticed, that if number of results stays the same, items titles are not updated (redrawn). How do I force t...

Apply a CIFilter background filter when host window is transparent

I want to replicate the background of dock Stacks in grid and list mode. The background is translucent black with a blur effect: The problem is that [CALayer backgroundFilters] only applies to content in the window, the filters are not applied to content in other windows. Here's my code: - (void)applicationDidFinishLaunching:(NSNotif...

Problem while displaying content in WebView in Leopard.

Hi all, I made a sample application consisting of : WebView (to display content of a URL), textfield (to contain a URL), button (to load URL in WebView). I used this method to display contents in WebView: - (IBAction)displayAction:(id)sender{ NSString *liveStreamLink = [[NSString alloc] initWithString:[livestreamLinkTextField str...

Leak in OpenCV NSImage To IplImage converter procedure

I have a leak in the code which I put below. When I used cvCreateImage instead of cvCreateImageHeader it was 304Kb and 107b leak but when I changed it became to be 107 bites only. Could You help me to find leak. (IplImage *) nsImageToIplImage:(NSImage *)image { // NSImage to IplImage NSBitmapImageRep *orig = [[image representations] o...

NSMenuItem Hidden binding issue

I have an NSMenuItem which I have bound to an NSUserDefaults boolean value in IB like so: When bMenuHidden is true, I would like my NSMenuItem to be hidden, and vice versa. This works as expected under Snow Leopard. However, Leopard struggles in some cases. In particular: my NSMenuItem is visible upon first launching the application, ...

Have a LaunchAgent sleep when the computer sleeps.

I'm creating a daemon that will be installed in the LaunchAgents folder. Some questions about making it sleep: Because it's a LaunchAgent item will the executable automatically sleep when the user/system sleeps? If the answer is yes to question 1, do I need to specify anything in the plist document? If the answer is no to question 1, w...