soffes / sstoolkit

A collection of well-documented iOS classes for making life easier
MIT License
3.31k stars 573 forks source link

SSHUDView doesn't fill screen for iPhone 5 #164

Closed bobbytables closed 11 years ago

bobbytables commented 11 years ago

It seems that SSHudView doesn't fill the screen vertically on iPhone devices.

webdevotion commented 11 years ago

The fix is present in the git repo.

Replace drawRect in SSHudWindow.m with the contents of: https://github.com/soffes/sstoolkit/blob/master/SSToolkit/SSHUDWindow.m#L51

The updated code deprecates the use of the old style which used a UIImage. The image has been replaced by a at runtime generated graphic.

- (void)drawRect:(CGRect)rect {
    if (_hidesVignette) {
        return;
    }

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGGradientRef gradient = SSCreateGradientWithColors(@[[UIColor colorWithWhite:0.0f alpha:0.1f], [UIColor colorWithWhite:0.0f alpha:0.5f]]);
    CGPoint centerPoint  = CGPointMake(self.bounds.size.width / 2.0 , self.bounds.size.height / 2.0);
    CGContextDrawRadialGradient(context, gradient, centerPoint, 0.0f, centerPoint, fmaxf(self.bounds.size.width, self.bounds.size.height) / 2.0f, kCGGradientDrawsAfterEndLocation);
    CGGradientRelease(gradient);
}
bobbytables commented 11 years ago

Awesome, thanks! My solution was just to hide the vignette until I could figure it out. Time to turn it back on.

webdevotion commented 11 years ago

Glad I was able to help you :+1: