jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

Circular bezelView #354

Closed brendand closed 8 years ago

brendand commented 8 years ago

In the legacy version I was able to use the following code to get a nice circular shaped view with the activity spinner inside. The bezelView was slightly larger than the UIActivityIndicator itself.

- (void)startLoading {
    self.hud = [[MBProgressHUD alloc] initWithView:self.iconImageView];
    [self.iconImageView addSubview:self.hud];
    self.hud.color = [UIColor colorWithRed:0.0471 green:0.349 blue:0.6 alpha:1.0];
    self.hud.yOffset = 3.5;
    self.hud.cornerRadius = 22.0;
    self.hud.margin = 4.0;
    [self.hud show:YES];
}

But nothing I do now with the latest version seems to make that work anymore. It's always much too big and never a perfect circle like I had it before.

Is there any other way to control the shape and size of the bezelView?

matej commented 8 years ago

Works just fine here. Even with the deprecated API you are using. I just need to set a different radius.

screen shot 2016-04-02 at 21 10 37

simulator screen shot 2 apr 2016 21 11 16

To make this a bit more robust, and less magic number fiddling, rather subclass MBPorgessHUD, override layoutSubviews and after calling super do something like this: self.bezelView.layer.cornerRadius = CGRectGetHeight(self.bezelView.frame) / 2.f;.