Questions tagged [cocoa]

Cocoa is Apple's application-development framework for macOS, consisting of Foundation, Application Kit, and Core Data. Use the "cocoa-touch" tag for iOS questions.

Cocoa is Apple's application-development framework for macOS, consisting of Foundation, Application Kit (AppKit) and Core Data.

The Cocoa frameworks consist of libraries, APIs and runtimes that form the development layer for all of macOS.

Related tags

Debugging Techniques

Cocoa programs can be debugged with many techniques and tools, both general and specific to Objective-C, Xcode and macOS.

External Resources

General Resources on SO

Memory Management

More information

39610 questions
14
votes
1 answer

Hide tab bar in NSTabViewController in storyboard

Does anybody know how to hide the tabbar within a NSTabView? There are just iOS versions out there but I need a solution for OSX. Here is my storyboard: I want to hide the tabbar… Where do I have to do it and how do I have to do it?
Tom el Safadi
  • 6,164
  • 5
  • 49
  • 102
14
votes
1 answer

Set non-owned window always on top - Like the app "Afloat"

I have set up a global hotkey with RegisterEventHotkey. When the user presses it, it gets the currently focused window with CGWindowListCopyWindowInfo, and then I need to set it always on top. If the current window is in my process (from which I am…
Noitidart
  • 35,443
  • 37
  • 154
  • 323
14
votes
2 answers

NSApplication endSheet: has no effect

Ok, this is really stumping me: I create a modal sheet on a window as -(IBAction) login: (id) sender { [NSApp beginSheet:loginWindow modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil]; } and try to…
tomwhipple
  • 2,850
  • 27
  • 28
14
votes
3 answers

In Objective-C Determine if a Property is an int, float, double, NSString, NSDate, NSNumber, etc

I need to determine an object's property (passed by name) type in order to perform deserialization from XML. I have some general pseudo-code (however I am unsure of how to perform these comparisons in Objective-C): id object = [[[Record alloc] init]…
Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232
14
votes
7 answers

OSX Application: how to make window maximized?

I am working on a mac application, and I like to make initial window be in maximized state, like when you are pressing green button with plus sign. I don't want it to be full screen.
14
votes
4 answers

Buffering NSOutputStream used as NSInputStream?

I have this consumer class that takes an NSInputStream as argument which will be processed async, and I want to push data that comes from a producer class that requires that it has an NSOutputStream provided as its output source. Now how could I set…
cahlbin
  • 1,039
  • 10
  • 17
14
votes
2 answers

Copy NSView in cocoa / objective-c

I can't see any way to copy an NSView and create an identical NSView object. I see google hits about "use an NSData" but I don't understand that.
Nektarios
  • 10,173
  • 8
  • 63
  • 93
14
votes
1 answer

How to chop off file:// from NSURL

I have an NSURL. It is file://localhost/Users/Me/File.xml I want an NSString that is /Users/Me/File.xml Is there some nice function I can use to do this?
Randall
  • 14,691
  • 7
  • 40
  • 60
14
votes
2 answers

How can my OS X app accept drag-and-drop of picture files from Photos.app?

When dragging pictures from the new Photos.app, no URL is passed in the pasteboard as part of the dragging info. My app already correctly handles images passed from e.g. iPhoto, Photo Booth, Aperture,... I tried dragging pictures from Photos.app:…
charles
  • 11,212
  • 3
  • 31
  • 46
14
votes
4 answers

Prevent resizing of a view controller presented as a sheet?

Is there a way to prevent a view from being resized if the view controller is presented as a sheet using the method presentViewControllerAsSheet or using a segue of style "sheet"? Note that modal/show segues can be implanted to a window controller…
ZestyZest
  • 911
  • 13
  • 27
14
votes
4 answers

Change NSSlider bar color

I've got an NSWindow and an horizontal NSSlider. I'd like to change the color of the right part of the slider bar when the window background color changes. Currently, the right part of the bar isn't visible anymore when the window background is…
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
14
votes
6 answers

Set the placeholder string for NSTextView

Is there any way to set the placeholder string for NSTextView like that in NSTextField? I have checked the property but couldn't find it. I have searched some questions but there isn't a proper explanation.
Zeist
  • 635
  • 1
  • 7
  • 17
14
votes
4 answers

Printing contents of WKWebView (OS X)

I am trying to print the contents of a WkWebView, but when the print panel appears the print preview is empty. Here is the code: - (void)viewDidLoad { [super viewDidLoad]; WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]…
klaidazs
  • 151
  • 1
  • 3
14
votes
5 answers

UIDatePicker - Problem Localizing

I've created a UIDatePicker in my app and I also have support for several languages. My UIDatePicker is created in Interface Builder, and I have created a seperate localization XIB so I can customize my UIDatePicker. Setting the "Locale" option in…
Smorpheus
  • 572
  • 1
  • 4
  • 12
14
votes
3 answers

How can I make my NSTextField NOT highlight its text when the application starts?

When my application launches, the first NSTextField is being selected like this: I can edit the NSTextField fine, but when I press enter to end the editing, the text becomes selected again, and the editing does not end. I followed the Apple…
swanhella
  • 441
  • 6
  • 14