Questions tagged [nsrect]
27 questions
4
votes
1 answer
How to get NSAttributedString substring that fit specific rect?
I want a implement ViewControllers acting like a "Kindle App" by using UIPageViewController and my CustomTextViewController.
But I can't find a way to get substring of NSAttributeString that fit specific rect.
I have a NSAttributeString of 70,000…

Paul
- 759
- 2
- 7
- 20
3
votes
1 answer
Put NSRects into an array, as objects?
I want to make a NSMutableArray and fill it up with rectangles created with, say, NSRectMake. But the array only allows objects. What should I do to save the NSRects in an array?

Saturn
- 17,888
- 49
- 145
- 271
3
votes
1 answer
What is the unit of NSPoint, CGPoint, NSSize, CGSize and NSRect, CGRect?
What is the unit of CGPoint, CGSize and CGRect ; NSSize, NSPoint and NSRect?

Colas
- 3,473
- 4
- 29
- 68
3
votes
1 answer
cocoa - draw image in NSRect
I'm having difficulties drawing an image in an NSRect, the code below creates an NSRect at the desired position and also puts an image in. The problem is that the image is a circle with a transparent areas and these get filled in black, so instead…

Lennart
- 1,560
- 5
- 20
- 38
2
votes
1 answer
NSRect.fill() not working with clear colors on Xcode 9 Swift 4
Swift 4 has a new NSRect.fill() function to replace NSRectFill(). When attempting to clear a bitmap using NSColor.clear.setFill(), the bitmap remains unchanged using NSRect.fill().
A workaround is to use NSRect.fill(using:) and specifying…

Dave
- 145
- 1
- 9
1
vote
2 answers
NSRect on main screen without window
I was wondering if it is possible to create an NSRect with maybe an NSMakeRect to make a simple square that will display on the screen without a window or any view behind it, just made all in code.
This is what I have as an…

Grant Wilkinson
- 1,088
- 1
- 13
- 38
1
vote
1 answer
Populating NSRectPointer in Swift
I'm translating some Objective-C code I got from a book to Swift. The code in question is a custom implementation of an NSTextContainer method:
-(NSRect)lineFragmentRectForProposedRect:(NSRect)proposedRect
…

Paul Patterson
- 6,840
- 3
- 42
- 56
1
vote
0 answers
Difficulty moving windows if "Displays Have Separate Spaces" is selected in OS X
In my OS X app, I'm working on a custom window item that needs to be able to be dragged between separate screens. Since the window does not have a title bar, dragging capabilities had to be implemented manually.
However, I'm running into a problem…

narner
- 2,908
- 3
- 26
- 63
1
vote
1 answer
NSImage drawInRect:fromRect:operation:fraction: coordinate system
The documentation says that the first parameter is
"The rectangle in which to draw the image, specified in the current
coordinate system"
What does it mean? Should I assume the size of that rectangle is in pixels or in points?

user732274
- 1,069
- 1
- 12
- 28
1
vote
1 answer
drawSwatchInRect drawing diagonal line when using NSColor with Alpha
I'm trying to draw a transparent highlight color in my TableView pretty simply:
if ([self isSelected]){
self.alphaValue = 0.5f;
NSColor * fillColor = [NSColor colorWithCalibratedRed: 100.0f/256.0f
…

aroooo
- 4,726
- 8
- 47
- 81
0
votes
2 answers
setNeedsDisplay for DrawRect after button press
I have this in a custom class on my NSView and when I press a button using my drawMyRec IBAction I want to change the color of my NSRect however this is not working, can anyone help?
#import "myView.h"
@implementation myView
-…

Grant Wilkinson
- 1,088
- 1
- 13
- 38
0
votes
1 answer
SetNeedsDisplay not drawing NSRect
My NSRect is being drawn in BrightnessView.m and it is connected to the custom class of NSView on a xib called "brightness". PanelController is connected to another xib called "controller" and that is where the slider is with the action. Panel…

Grant Wilkinson
- 1,088
- 1
- 13
- 38
0
votes
1 answer
Update NSRect Color or Redraw
what I am trying to do is have an NSSlider and whenever I change the value I want it to update the color of my NSRect. Will I need to remove my NSRect and redraw it every time I want to change the color or how would I go about this? If I have to…

Grant Wilkinson
- 1,088
- 1
- 13
- 38
0
votes
1 answer
How to make dataWithEPSInsideRect vector rather than bitmap in vector format?
Hello i'm trying to export data from an NSImageView as an EPS vector however the export doesn't appear to be vector but more like a bitmap in EPS format.
Can anyone suggest where I am going wrong and how I can make it vector?
s = [[graphicImage…

GeraldTheGerm
- 63
- 6
0
votes
0 answers
NSRect geometric properties
I have some problems with NSRect : everything works great for my image until I open Full Screen. My image moves down accordingly NSRect positions and not of image's constraints. How can I fixe my constraints for this ImageView in NSRect?
let…

J.A.
- 61
- 1
- 5