nsview

The Autosizing property setting for NSView is missing

*爱你&永不变心* 提交于 2020-01-01 10:54:03
问题 I ran into this really frustrating issue today. I want to set my view to be autosizing like this: But all I find in my xcode settings for an NSView is like this: The two screenshots are taken from two different projects with the same xcode 4.3.2. Is this a bug or am I missing something? Thanks. 回答1: Seaid's solution works. but i think it's bug because the auto sizing tool will apear about half a second when switching to another inspector. Xcode 4 interface-builder problems 回答2: Starting in

Swift: Switch between NSViewController inside Container View / NSView

天涯浪子 提交于 2020-01-01 09:37:23
问题 I want to achieve a really simple task—changing the ViewController of a Container View by pressing a button: In my example the ViewController1 is embedded into the Container View using Interface Builder. By pressing the Button ViewController2 I want to change the view to the second ViewController. I’m confused because the Container View itself seems to be a NSView if I create an Outlet and as far as I know a NSView can’t contain a VC. Really appreciate your help! 回答1: Just note that in order

Subclassing an NSDrawer's contentView to implement a completely custom drawer

三世轮回 提交于 2019-12-30 11:15:20
问题 I want to implement my own custom drawer completely by subclassing NSView and doing all my view drawing in that. I've created a custom NSView class that does hardly anything apart from implement initWithFrame: and drawRect: which I've got logging the frame/bounds of the NSView (which is reporting correctly). I've also instantiated this view and added it to the NSDrawer object in my application using setContentView: so that it uses my custom NSView. However, this still draws a default drawer

Subclassing an NSDrawer's contentView to implement a completely custom drawer

本秂侑毒 提交于 2019-12-30 11:15:12
问题 I want to implement my own custom drawer completely by subclassing NSView and doing all my view drawing in that. I've created a custom NSView class that does hardly anything apart from implement initWithFrame: and drawRect: which I've got logging the frame/bounds of the NSView (which is reporting correctly). I've also instantiated this view and added it to the NSDrawer object in my application using setContentView: so that it uses my custom NSView. However, this still draws a default drawer

Animated rotation of NSView contents

徘徊边缘 提交于 2019-12-30 11:07:33
问题 I'm trying to rotate the contents of an NSView ( NSButton ) in-place (I.e. from the center. I want to convert - into | ). This can be done with setFrameCenterRotation: … However, I'm trying to animate this, and [[myview animator] setFrameCenterRotation: 90]; causes the control to first jump to the right, and then rotate around the bottom-left corner (0,0) back to the original location. Some people have suggested first setting the anchorPoint : [[myview layer] setAnchorPoint: NSMakePoint(0.5,

Saving an NSView to a png file?

谁说我不能喝 提交于 2019-12-29 04:28:16
问题 I am making a simple program that creates game cards for a game I play. I have sent it out to some friends of mine for testing, but they really want it to save images, not just print them. I have tried to make it save as a .png file. I have to questions here. How can I make it save my view as a .png file, including all of the view's NSImageWells. How can I add an NSPopupButton to an NSSavePanel to allow users to select a format? Any help is greatly appreciated. 回答1: First create a TIFF

Make NSView NOT clip subviews outside of its bounds

泄露秘密 提交于 2019-12-29 03:53:26
问题 Is it possible to make an NSView not clip its subviews that are outside of the bounds? On iOS I would simply set clipsToBounds of my UIView no NO . But NSView doesn't have such a property. I tried experimenting with wantsLayer , masksToBounds , wantsDefaultClipping , but all of these seem to only change the clipping of the drawRect method, not the subviews. 回答1: After 5 hours of struggling I've just achieve it. Just change class of any NSView in .storyboard or .xib to NoClippingView and it

Property Editor Control for Cocoa?

我怕爱的太早我们不能终老 提交于 2019-12-25 09:20:47
问题 Is there any Cocoa Widget which i can use to build a typical (well except in Interface Builder) GUI builder property inspector like RealBasic or Delphi has? And is there a website where additional 3rd party Cocoa widgets are listed? 回答1: InspectorKit (github) might be what you are looking for. 回答2: If you're using Core Data, you can option-drag a Core Data entity from Xcode (in your model) to an IB window and it will automatically create an inspector-type view. I'm not familiar with RealBasic

Possible to use NSView subclass in NSTableView?

妖精的绣舞 提交于 2019-12-25 03:53:45
问题 I have an NSView subclass that I'd like to use in an NSTableView . Normally of course I'd use a NSTableCellView subclass but this view will be used elsewhere. Possible? 回答1: Change your NSView subclass to inherit from NSTableCellView instead of NSView , since NSTableCellView also inherits from NSView too. 回答2: There's no requirement that the cell view used for a view-based table view be an NSTableCellView or subclass. It's perfectly OK to use an instance of some other view object. For example

NSView inside an NSPopover: Converting Coordinates

别说谁变了你拦得住时间么 提交于 2019-12-24 16:30:02
问题 Context Let P be an NSPopover and view be an NSView that is a subview contained within P . What I Need I want to take the frame of view and convert it to the screen's coordinate system. Normally, you would do that like this: NSRect frameRelativeToWindow = [self convertRect:self.frame relativeToView:nil]; [self.window convertRectToScreen:frameRelativeToWindow]; However, because view is in an NSPopover, its window property is nil and the above method will return NSZeroRect: [0, 0, 0, 0] So, how