Questions tagged [drawrect]

Method in UIView/NSView class. Draws the receiver’s image within the passed-in rectangle.

Signature

- (void)drawRect:(CGRect)rect

rect - The portion of the view’s bounds that needs to be updated. The first time your view is drawn, this rectangle is typically the entire visible bounds of your view. However, during subsequent drawing operations, the rectangle may specify only part of your view.

The default implementation of this method does nothing. Subclasses that use native drawing technologies (such as Core Graphics and UIKit) to draw their view’s content should override this method and implement their drawing code there.

1051 questions
-1
votes
1 answer

drawrect to fit uiview no matter the size

I have a uiview class that calls a custom drawing class method with a drawrect in it. The drawrect drawing coordinates are drawn for a 433x439 uiview. When this app opens on an iPad Pro autolayout changes the size of the uiview (correctly). But the…
malaki1974
  • 1,605
  • 3
  • 16
  • 32
-1
votes
1 answer

Best way to implement view like map

I'm making view that represent something like map, with pan and pinch gestures. At current moment it's implemented via overriden drawRect that called in handlePan with setNeedsDisplay. So, the resulting performance a little bit awkward. Is there any…
user1261347
  • 315
  • 2
  • 15
-1
votes
1 answer

How to draw the spectrogram from data the stft?

I have calculated stft(short time fourier transform) data. That is the number of the form a+bi. how would these can be drawn the spectrogram of frequency vs time, what function in java can I use. how to draw up like. I need one solution.
user2345050
  • 21
  • 1
  • 4
-1
votes
1 answer

Constrain rectDraw inside UIView

I have a UIView which inherits from a custom UIView subclass where the drawRect method looks like this: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetStrokeColorWithColor(context,…
Chizx
  • 351
  • 2
  • 5
  • 16
-1
votes
1 answer

drawRect line moves on different screen size

I'm using drawRect to create a line. Based on the "4inch screen" my line is the correct place. When ran on a "3.5 inch screen" the line is lower down and in the wrong place. - (void)drawRect:(CGRect)rect { CGContextRef firstLine =…
user2920762
  • 223
  • 1
  • 8
  • 17
-1
votes
1 answer

Using drawRect except view frame

I draw some screenColor gradient with - (void)drawRect:(CGRect)rect I want not draw it on full screen except selected frame. Is it possible to do or what is the faster way to accomplish it?
-1
votes
1 answer

about the drawRect

I want to draw a picture in a context area, but the things is no matter what the values I changed in to the picture I draw cannot be bigger ( which is like cannot extend out of an area). I use drawRect: method to do this.Can I change the rect size?…
Jack G
  • 107
  • 1
  • 5
-1
votes
1 answer

Drawing on CATiledLayer or CALayer with pdf in iOS

i have a scrollview which contains a pdfpage rendered with CATiledLayer, i want to draw stuff onto the pdf page so i created a overlay layer, i need the graphic to look vectorized so i decided to use CATiledlayer for the overlay layer. Only problem…
Krewie
  • 115
  • 1
  • 11
-2
votes
2 answers

How to call -(void)drawRect:(CGRect)rect

How Can i Call -(void)drawRect:(CGRect)rect in https://github.com/stkim1/MTImageMapView/blob/master/MTImageMapView/MTImageMapView.m From Another UiViewController Periodically With NSTimer
rva
  • 57
  • 1
  • 9
-2
votes
1 answer

IOS - in drawRect func layer properties can not be changed?

I created a class that inherit from view object (UIButton) I don't understand why when i'm trying to change the backgroundColor that i add in drawRect func by init or by awakeFromNib func it succeed, but when i'm trying to change property of layer…
r.pul
  • 109
  • 2
  • 9
-2
votes
2 answers

How to get rotated image of imageview in uiview?

I created RotatedView subclass of UIView and added UIImageView as subview of RotatedView and also draw a image on RotatedView using drawRect: method same as image of imageView. I applied pinch and rotate gestures on imageView. When i pinch the…
Prasad G
  • 6,702
  • 7
  • 42
  • 65
-2
votes
1 answer

How to change the text of color in drawRect Method

I want to change the color of the text in drawRect: method when clicking on a color buttons in my switchColor method. Here is my code: - (void)drawRect:(CGRect)rect withColor:(UIColor*) color { CGContextRef context =…
ios54
  • 1
  • 1
  • 4
-2
votes
1 answer

Need clarifications working with Views in iOS

Ok, I'm learning programming for iOS with Stanford's online course on iTunes U (CS193P) but I can't exactly get a hold on how all the stuff from UIView works. Could someone explain how the following things work cohesively and how I should use…
James Traimory
  • 513
  • 1
  • 4
  • 8
-3
votes
1 answer

drawRect in a subclass view without another implementation

I want my drawRect function, -(void)drawRect{ NSBezierPath * path = [NSBezierPath bezierPath]; [path setLineWidth:4]; NSPoint center = {ycord,xcord}; [path moveToPoint: center]; [path appendBezierPathWithArcWithCenter:center …
evdude100
  • 437
  • 4
  • 18
-3
votes
3 answers

setNeedDisplay still does not work

Previously I asked a question in stackoverflow and that is about setNeedsDisplay cannot work. I am not a lazy guy and I have tried everything but it still cannot work. Maybe I cannot find where is the problem. Can anyone help me to find out the…
IvyBB
  • 60
  • 7
1 2 3
70
71