jdg / MBProgressHUD

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

Using customView wrong size #485

Closed 0x1306a94 closed 7 years ago

0x1306a94 commented 7 years ago
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    UIView *v = [[UIView alloc] initWithFrame:(CGRect){0,0,150,150}];
    v.backgroundColor = [UIColor orangeColor];
    hud.mode = MBProgressHUDModeCustomView;
    hud.customView = v;

(lldb) po self.bezelView.subviews <__NSArrayM 0x1c44636c0>( <UIVisualEffectView: 0x11dd10090; frame = (0 0; 40 40); autoresize = W+H; layer = <CALayer: 0x1c4037880>>, <UILabel: 0x11dd11190; frame = (0 0; 0 0); opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c4283f20>>, <UILabel: 0x11de0f810; frame = (0 0; 0 0); opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x1c028a230>>, <MBProgressHUDRoundedButton: 0x11de10080; baseClass = UIButton; frame = (0 0; 0 0); opaque = NO; layer = <CALayer: 0x1c0220a20>>, <UIView: 0x11de11020; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x1c02208c0>>, <UIView: 0x11de11200; frame = (0 0; 0 0); hidden = YES; layer = <CALayer: 0x1c0220760>>, <UIView: 0x11dd17340; frame = (0 0; 150 150); tintColor = UIExtendedGrayColorSpace 0 0.7; layer = <CALayer: 0x1c4039b40>> )

matej commented 7 years ago

MBProgressHUD uses auto layout for sizing. You need to add sizing constraints to your custom view instead of just setting the frame.

albertjson commented 6 years ago

customView uses auto layout, and customView subview uses frame. i did it ,perfect!