drawrect

iPhone: drawRect called once

I'm calling setNeedsDisplayInRect from an NSTimer function every two seconds. This works perfectly, and draws a square in a random position, with a random color. However, in some circumstances I would like to draw a square x number of times in the NSTimer function (using a for loop) - but, after numerous error testing it seems that drawR...

My drawRoundRect is not drawing a rounded rectangle :( [Flash]

Hi everyone, I just wrote a Background class for a new project. The background is basically going to be 2 rounded rectangles with a simple stroke and fill color laid on top of each other. Anyways right now I'm just trying to draw out 1 rounded rectangle, but for some reason I don't see it anywhere on stage :( No errors and my traces tra...

Drawing a CGLayer outside the method drawRect: faster?

I'm not really sure, what am I asking... ...but if make layer composites in separate methods, and draw them to the view also outside of the drawRect: method... ...then could my app performance get raised? I'm actually subclassed a puzzlePiece:UIView class, where the puzzlepiece gets rendered, but the redraw invoked now with setNeedsDis...

DrawRect of UIView inside UIScrollView

I'm trying to draw a small image on a UIScrollView for my iPhone app. I started with a UIImage created from a png I included in my bundle and that works ok. Every time the zooming/panning stops the delegate of the scrollview recalculates the frame of that UIImage (which is a subview of the UIScrollView's contentView) and calls setNeedsDi...

Problem with setNeedsDisplayInRect (quartz2d, iPhone)

Hi everyone. I have written a function that draws x number of squares in a random position every 2 seconds. A square cannot be drawn in the same position twice. Once the app has completed a cycle the grid will be filled in. Now, this works fine when the number of squares drawn is <=8, however when this is higher a square is randomly draw...

uiview getter nil

I am trying to get certain iVars from my view controller to my view (a subview) so drawrect will draw a shape based on user inputs. When I hard code those variables into the subview, the shape draws perfect, but when I use getters to access the custom variables from the view controller, they come back nil and the drawing is messed up. ...

UITableView Did Load (Done drawing the cells)

Question How can you detect when the Table View is done drawing the cells? Issue I got two labels within the contentView of an UITableViewCell. The size of these labels are dynamic. I was able to do so by subclassing UITableViewCell, in the drawRect method I adjust the frames of the two labels depending on their content. Now I want to...

Applying a stroke to a rounded rect in core-graphics

I have a gradient that has rounded corners that I an using for a custom UITableViewCell background. I am trying to apply a stroke to the path but cannot quite do it, and can't see where I am going wrong. CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) ...

MKAnnotationView disappearing on swipe and double-tap zoom

I have subclassed MKAnnotationView to create an annotation that basically draws a circle around a point on a map view through override of drawRect. The circle draws fine in the following situations (in the simulator): On initial load of the map view On swipe, but only when swipe motion is stopped before touch ends (so that map doesn't...

UISearchBar: Changing the appearance - Shape, Background, Overlay an Image

I'd like to change the appearance of the default UISearchBar. As an example, how would you recreate the search box in the Google iPhone app as seen below? How would you overlay an image to produce this effect? ...

Help needed with drawRect:

Hi, I'm having a fundamental issue with use of drawRect: Any advice would be greatly appreciated. The application needs to draw a variety of .png images at different times, sometimes with animation, sometimes without. A design goal that I was hoping to adhere to is to have the code inside drawRect: very simple and "dumb" - i.e. just do...

Rendering a UIWebView in drawRect with loadHTMLString

Hello there, I am having a problem with UIWebView. I'd like to render my own html code in it. When I add a webview as a subview and put in some html code it renders just fine. When it gets down to some optimized drawing of tableview cell with the drawRect method the problem pops up. Drawing UIView descendants works pretty well this way. ...

Actionscript: Why is drawRoundRectComplex() not documented?

in studying actionscript 3's graphics class, i've come across the undocumented drawRoundRectComplex() method. it's a variant of drawRoundRect() but with 8 parameters, the final four being the diameter of each corner (x, y, width, height, top left, top right, bottom left, bottom right). //example var sp:Sprite = new Sprite(); sp.graphic...

iPhone SDK: How to trigger drawRect on UIView subclass after orientation change?

I am subclassing a UIView and overwrite the drawRect method. I'm noticing that the view's drawrect is only being called when the view first loads. After that it is never called again. How to I make sure it gets called after an orientation change? I've tried calling setNeedsDisplay on the view before and after the rotation and that doesn'...

Iphone SDK quesiton: How to make a Drawing method in a View class work using CGContextRef?

I have these 2 methods in the View class. the drawRect method always gets called when the view is initalized. But i can't get the drawLine method to work. It doesn't do anything when it gets called. Am i supposed to deal with cgimagecontext or something like that? please help!! - (void)drawRect:(CGRect)rect { // Drawing code // ...

draw line over uilable after loading from nib

here is my code CGContextRef c = UIGraphicsGetCurrentContext(); CGContextBeginPath(c); CGContextMoveToPoint(c, 277.0f, 21.0f); CGFloat newpoint = 277.0f + (CGFloat)(self.msrp.text.length * 8); //NSLog(@"%f", newpoint); CGContextAddLineToPoint(c, newpoint, 21.0f); CGContextStrokePath(c); i am trying to draw a line over UIlabel, i am lo...

iPhone CALayer Stacking Order

I'm using CALayers to draw to a UITableViewCell. I'm trying to figure out how layers are ordered with the content of the UITableViewCell. For instance: I add labels to the UITableViewCell in my cellForRow:atIndexPath method In the drawRect method of UITableViewCell I draw some content using the current context Also, in drawRect I add...

java drawing rect in panel

ı draw rect on to jpanel but it is only seeing when changing the active operation system window. ...

Custom UITableViewCell not properly hiding views

I am using apple's custom table view cell code and modifying the drawRect code within the cell's view to look like I want it to. I've changed it to have some UILabels as well as a UIProgressView. If the data the cell is being built on doesn't have a certain field, I want the UIProgressView to be hidden. This works for a little while, ...

Drawing selected state on custom UITableViewCell

I have a customer UITableViewCell whose whole display is drawn indrawRect. When it draws it creates CGLayers so that it can reuse certain pieces when something is changed. I have changed my UITableViewCellSelectionStyle to "None" because I don't want the default selected view to cover my drawing. My problem is that I call setNeedsD...