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
1 answer

Paint : How to draw arc using gradient image or Bitmap image

i am able to draw arc using Paint and passing some gradient color to it, my problem is that i need draw the arc using a gradient image.Is it possible to draw arc using an image? If so how to do it? this is my current code: Paint nPaint = new…
Goofy
  • 6,098
  • 17
  • 90
  • 156
0
votes
2 answers

UINavigationBar drawRect Alternative (aka, Need CoreGraphics calls in a category)

I recently discovered that in > iOS5 UINavigationBar does not get its drawRect called. I want to figure out how to draw with Core Graphics in a category. The end goal I am trying to achieve is eliminating images from my app and have everything…
Weston
  • 1,481
  • 1
  • 11
  • 31
0
votes
1 answer

iOS: jumpy animation when changing orientation, setFrame

I'm using the code below to set up a view when the orientation changes on an iOS device. This works to give me the shape I want (wider and same height), but the animation is jumpy when changing orientations. If I hide the setFrame code the animation…
OWolf
  • 5,012
  • 15
  • 58
  • 93
0
votes
2 answers

iOS - UIView. What are the limitations of using drawRect to do data retrieval?

For my iOS app I am implementing a "lazy" data loading scheme that is almost there, but not quite. I override my UIView subclasses drawRect method thusly: The overridden drawRect method CGContextRef context =…
dugla
  • 12,774
  • 26
  • 88
  • 136
0
votes
1 answer

Dynamic value to ECGraph

I am using ECGraph in my application, I need to add myTopNameStr dynamically in drawRect method which is defined in DisplayView.m (inherited from UIView) from an NSArray which is in ECGraphViewController.m - (void)drawRect:(CGRect)rect…
Ankur Arya
  • 4,693
  • 5
  • 29
  • 50
0
votes
1 answer

How to speed drawing a grid of UIViews?

Currently I instantiate a 2-d matrix of UIViews. Each UIView's drawRect is overridden to draw 1 of 2-3 shapes. As the grid scales larger, I am noticing excessive time spent in the drawRect of each subview. Since I only have 2-3 shapes, I would like…
Electro-Bunny
  • 1,380
  • 2
  • 12
  • 33
0
votes
1 answer

drawInRect of UIImage is Not working

I am Hardly Trying to learn New things with CoreGraphics. I have a the below code and the image is not set using drawInRect function. - (void)viewDidLoad { [super viewDidLoad]; imgView=[[UIImageView alloc]init]; [self…
Vanitha
  • 91
  • 1
  • 10
0
votes
1 answer

Draw UIImage with resizableEdgeInsets in center with stretched sides

I thought it was possible, since UIImageView does this just fine. Can I draw a UIImage in UIView's drawRect: method in a way that I center the image horizontally, and the sides of the UIImage are then stretched to fill the reminder of the UIView? -…
runmad
  • 14,846
  • 9
  • 99
  • 140
0
votes
1 answer

Overlaying color on a NON rectangle shade

I am creating a heat map as an overlay for an image, the sections of the heat map are not rectangles and thus makes it a bit more difficult to overlay a color because when you overlay a color of the image it also hits the transparent pixels of the…
Luke
  • 612
  • 1
  • 6
  • 19
0
votes
1 answer

How to drawRect in a DataGrid Cell AS3

I have programmatically placed my datagrid with fields on the stage and a rectangular shape on the same stage. What I need to do now is to have cells in a column of the datagrid contain the rectangular shape(s), instead of text. What I am trying to…
Hannington Mambo
  • 998
  • 2
  • 13
  • 28
0
votes
1 answer

- (void)drawRect:(CGRect)rect , draw a maze and detect its boundary

I'm trying to implement a maze game that will draw its own levels by a code developed on drawRect , I just need to know how to detect the boundary of the content of the image that will be drawn by the code, I'm using an UIButton wich is draggle…
user1709502
0
votes
1 answer

Speed up -drawRect: method for UIView subclass

I've created a custom UIView subclass. Everything works fine on the simulator, but very slow on the device. My -drawRect: method takes about 100 milliseconds to fully redraw the view. The speed problem arose when I added a pan gesture to this view…
user1897723
  • 181
  • 1
  • 1
  • 10
0
votes
1 answer

passing array to drawrect bar chart

I would like to draw a bar chart in an existing view on the user interface. The single bar highs are calculated after user input and stored in an array. The array should be passed to my custom GraphView class after a button is bushed to draw the bar…
JFS
  • 2,992
  • 3
  • 37
  • 48
0
votes
2 answers

objective-c drawrect with variables

I simply try to understand how to pass values from a textfield in AppDelegate to my NSView subclass "ViewController". I really don't get it. I'm new in objective-c and I start getting frustrated. Please just don't tell me to read books. I have…
JFS
  • 2,992
  • 3
  • 37
  • 48
0
votes
1 answer

xcode drawrect - UIView bounds not reflecting rotation in simulator

I'm using xcode 4.5.2 to learn to develop in iOS6. I have this code in my drawRect... - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGPoint midPoint; midPoint.x = self.bounds.origin.x +…
rockhammer
  • 957
  • 2
  • 13
  • 38