Dotted drawing between UICollectionView cells

I have to achieve something like this(please check attached ScreenShot). The best possible solution which came to my mind is UICollectionView. I have created rounded border along the cell and put a button on the cell. Now for the dotted straight line

draw with rounded corners

I have this code for UIVIew: override func drawRect(rect: CGRect) { let toolbarSize = CGFloat(UIDevice.currentDevice().userInterfaceIdiom == .Pad ? 0 : 54) let width = CGRectGetWidth(self.frame) let height = CGRectGetHeight(self.frame) - toolbarSize

Erase the drawing made on the image

So, I am working on a virtual wall painting app. I am able to draw some random lines by moving my finger on the image view(which has an image in it). Now I am trying to erase the drawings made on it without success as of yet. I googled to find some s

iOS 8 Crash - renderInContext: UIGraphicsGetCurrentContext ()

Before iOS 8, I didn't have problems with this & now, yes. LOG: Assertion failed: (CGFloatIsValid(x) && CGFloatIsValid(y)), function void CGPathMoveToPoint(CGMutablePathRef, const CGAffineTransform *, CGFloat, CGFloat), file Paths/CGPath.cc, l

Move and resize UILabel with CGAfficeTransform

Basically I want to move a UILabel up 20px and resize it to 55% of it's original size. => x stays the same, y,height, width decrease. What I came up is following : //_line a UILabel* CGFloat scaleFactor = 0.55f; [UIView animateWithDuration:1.0 animat

How to assign multiple shadows to NSText?

Right now I'm using NSShadow *textShadow = [NSShadow new]; textShadow.shadowBlurRadius = 5; textShadow.shadowColor = [[NSColor whiteColor] colorWithAlphaComponent:.5]; [self addAttribute:NSShadowAttributeName value:textShadow range:NSMakeRange(0, sel

Core Graphics Memory Leak

The analyser is flagging up a memory issue. Normally I would use autorelease but this is not possible in Core Foundation. How do I fix this error? - (CGMutablePathRef)NewCGMutablePathRefCreateWithRoundedRectForRect:(CGRect)rect andRadius:(CGFloat)rad

Where and how __bridge

I need some advice on __bridge-ing in iOS. Hopefully the SSCCE1 below will explain the problem better than I can in words, but I need to know how I can convert a void* to an NSMutableArray*; which __bridge variation should be used (See comment in cod

Effective way to draw a line by line graph in CALayer

I need to draw a line chart from values that come to me every half a seconds. I've come up with my custom CALayer for this graph which stores all the previous lines and every two seconds redraws all previous lines and adds one new line. I find this s

iOS - CoreImage - Add an effect to a part of the image

I just have a look on CoreImage framework on iOS 5, found that it's easy to add an effect to whole image. I wonder if possible to add an effect on special part of image (a rectangle). for example add gray scale effect on partial of image/ I look forw

iPhone iOS how to return / reflect any UIView on the spot?

I know how to flip/reflect/rotate a UIImage by re-drawing it within it's bounds. - (IBAction)reflectImageView:(UIImageView)imageView { UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 0.0); CGContextRef context = UIGraphicsGetCurrent

iOS: Draw a shadow in UIView

I found some great code that is a subclass of UIView which draws that view with a shadow. Then I can use that view anywhere I want to place the shadow: -(void) layoutSubviews { CGFloat coloredBoxMargin = 40; CGFloat coloredBoxHeight = self.frame.size

Confused about UIBezierPath + applyTransform + CGPath

I scale UIBezierPath (built of one [0,0 - 1x1] rect) by factor 2 in both x and y directions. UIBezierPath ".bounds" is alright (i.e. scaled as expected), while ".CGPath" remains unchanged... Code: #import <UIKit/UIKit.h> int main

iOS Image open source edition library - or some tips

For an ios app I'm writing, I'd like to take an photo from the photo library and then let the user "clean it up", essentially deleting parts of it that are not needed. For example, suppose the user chooses a photo of a person, my app only needs

How to use CGAffineTransformMakeRotation?

I want to draw text use Quartz 2D. The "menu" direction is wrong. I want "Menu" still readable and have 45 degree with X-axis. Below is my code: CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman); CGContextSetText

Make superlayer not visible

I have added sublayers to my UIView's layer. However, the root layer(UIView's layer) is visible at background as white rectangle. How can I effeciently hide superlayer so there will be no resourses spent on compositing with sublayers?If you just want

How can we change the color of a text programmatically?

My code is -(UIImage *)addText:(UIImage *)img text:(NSString *)text1 { int w = img.size.width; int h = img.size.height; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, col

What is the fastest way to implement a UIView background?

I have an UIView which I want to give a gradient background and I'm wondering how to implement that as efficient as possible. I am considering three options: Create an UIImageView as subview and give it an image of the gradient to display. Draw the g

Find min / max of quadratic bezier with CoreGraphics

I am using CoreGraphics to draw a quadratic bezier but want to computer the min/max value of the curve. I am not from a mathematical background so this has become a bit troublesome. Does anyone have any articles or ideas about how to solve this?For a

Draw a grid of images using Core Graphics in drawRect:

My problem is this: I have a simple block image that I want to make a grid out of. I have created an array of CGPoints in my UIView. Then I used blackImage = [UIImage imageNamed:@"black.png"]; and then - (void)drawRect:(CGRect)rect { for (int j