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
0
votes
2 answers

IOS Quartz 2D drawRect and Resizing

I'm using an app called Quarkee to convert a logo from SVG to Quartz 2d code, which works a treat. Only problem is I can't seem to figure out how resize the result. If I set the frame of the UIView, the result from drawRect stays huge in the frame.…
BigBadOwl
  • 669
  • 2
  • 9
  • 22
0
votes
2 answers

How to 'reset' a view full of drawings made with drawrect in IOS?

I have a very simple class for drawing on the screen following the finger. I want to set up a button to clear all the drawings and allow the user to start drawing again. I can't figure out what to do inside the button's action to 'clear' the…
Aleph72
  • 877
  • 1
  • 13
  • 40
0
votes
3 answers

iOS - DrawRect performance issue

I am using -drawRect for the first time in an attempt to alternatively speed up a UITableView. However, the drawRect method seems to be slowing the table down quite largely. Please can you tell me how I can improve the drawRect method below in…
max_
  • 24,076
  • 39
  • 122
  • 211
0
votes
1 answer

DrawRect add text shadow

I am using -drawRect for the first time in a custom UITableViewCell, and I want to know how I could add 1px dropShadows to all of the text being drawn, and the image (self.image). Thanks in advance. - (void) drawRect:(CGRect) rect { …
max_
  • 24,076
  • 39
  • 122
  • 211
0
votes
1 answer

UIBezierPath Not Drawing

I'm trying to implement a method which draws a line based on gesture recognition but I can't get the UIBezierPath to display. I know the gesture recognizer is functioning because I print to log every time the method is activated. What is also…
0
votes
1 answer

How to "throw" an array of points and draw continuous spline from them?

Need to draw a spline from a multiple points in drawRect. Is it possible to "throw" an array of points and draw continuous spline from them. Another option would be to loop among the points and to draw multiple splines, drawing a spline from 2…
Centurion
  • 14,106
  • 31
  • 105
  • 197
0
votes
2 answers

UIWebView to UIImage invalid context 0x0

I'm trying to do a simple task; convert the contents of a UIWebView to a UIImage and save it to the phone's documents directory, however I keep getting a bunch of similar errors every time the following code is run: …
jcrowson
  • 4,290
  • 12
  • 54
  • 77
0
votes
1 answer

CGGradientCreateWithColors not working on iOS 4 anymore

this is the code I use in a UIView subclass to easily add gradient views: #import "GradientView.h" @implementation GradientView @synthesize direction, startColor, endColor; -(id)initWithFrame:(CGRect)frame startColor:(UIColor *)start_color…
cboe
  • 469
  • 1
  • 9
  • 25
0
votes
1 answer

DrawRect never being called

I put this code in my app: -(void)setup { [self setNeedsDisplay]; NSLog(@"Test 1"); } -(void)drawRect:(CGRect)rect { NSLog(@"Test 2"); } I get a bunch of Test 1s on the NSLog (because this is a UITableViewCell), but no Test 2s at any…
Andrew
  • 15,935
  • 28
  • 121
  • 203
0
votes
2 answers

Call drawRect before showing modalViewController

I'm experiencing that the drawRect method is called after the modalViewController has shown. Is it possible call the drawRect method before, so there won't be any delay? Best regards Sebastian Søndergaard
0
votes
3 answers

UIView drawRect black Window

This is my drawRect method. - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef context = UIGraphicsGetCurrentContext(); CGMutablePathRef path = CGPathCreateMutable(); //1 CGPathAddRect(path, NULL, self.bounds…
Lolloz89
  • 2,809
  • 2
  • 26
  • 41
0
votes
2 answers

How to draw a default image in imageview in the center of imageView?

How to draw a default image in imageview in the center of imageView?using - (void)drawRect:(NSRect)rect overridden method of NSImageView
lance
0
votes
2 answers

Accessing drawRect method of a subview from a view in Cocoa

I have my main iOS view, with an UIVIew as subview linked to a class (called graphView). My graphView has a drawRect method that is initiated upon application start. Now, clicking on a button in the main view, I would like the sub UIView to refresh…
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
0
votes
1 answer

drawRect in UIView subclass doesn't update image

I have a UIView subclass that I would like to use to draw images with different blend modes. code: @implementation CompositeImageView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { //…
Nyth
  • 582
  • 5
  • 16
0
votes
1 answer

Quartz iPhone drawRect not called

I am subclassing a UIView and am calling it via a detail view controller. When I load it, it shows up with the right dimensions and positioning, however it is just a black square... When I just put a UIView into interface builder with the class,…
michaela
  • 173
  • 1
  • 2
  • 13