Search Results

Search found 2 results on 1 pages for 'davemac'.

Page 1/1 | 1 

  • CGGradient Not Displaying Correctly on iPad 1 and 2

    - by daveMac
    I have been experimenting with creating my own gradients for the UI in my iOS app. I first used a CAGradientLayer but I was disappointed with the "stepped" look so I have been trying out CGGradient. enter code here I am having an issue with the Gradient displaying correctly. I have three iPads—one for each generation. The gradient looks right on the iPad 3 but not on the iPad 1 or 2. This is really strange. I was going to take a screenshot and post the two differences but even more strange, the screenshot look the same (and yes, the brightness is the same on both). The colors seem really washed out on the older iPads. I know the iPad 3 is a retina display, but I think it must be something more than that. Here is the code I am using: - (void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(); CGGradientRef skyGradient; CGColorSpaceRef rgbColorspace; size_t num_locations = 3; CGFloat locations[3] = { 0.0, .5, 1.0 }; CGFloat components[12] = { .106, .73, .93333, 1., 0.0, 0.0 , 1.0, 1., .106, .73, .93333, 1. }; rgbColorspace = CGColorSpaceCreateDeviceRGB(); skyGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations); CGRect currentBounds = self.bounds; CGPoint topLeft = CGPointMake(0.0f, 0.0f); CGPoint bottomRight = CGPointMake(CGRectGetMaxX(currentBounds), CGRectGetMaxY(currentBounds)); CGContextDrawLinearGradient(currentContext, skyGradient, topLeft, bottomRight, 0); CGGradientRelease(skyGradient); CGColorSpaceRelease(rgbColorspace); }

    Read the article

  • Help moving multiple images at once with touches

    - by daveMac
    Here is my problem: I am trying to move a puzzle piece around the screen and then connect to the other piece if they are in close proximity. I have achieved this, though it is perhaps a little odd the way I did. My problem though is that once they have connected, I can't figure out how to move them as one image, instead of two separate entities. I would really appreciate any help or suggestions. Here is a sample of what I have been doing: (void)touchesMovedNSSet *)touches withEventUIEvent *)event{ UITouch *touch = [touches anyObject]; [self dispatchTouchEvent:[touch view] toPosition:[touch locationInView:self.view]]; } -(void)dispatchTouchEventUIView *)theView toPositionCGPoint)position{ if ((CGRectContainsPoint([picture frame], position))) { picture.center = position; } if (CGRectContainsPoint([picture2 frame], position)) { picture2.center = position; } }

    Read the article

1