Closed MonkeyS914 closed 8 years ago
If the view is nil here, than you're doing something wrong.
i just add the method in the rootviewcontroller
(void)initHUD{
RootHud = [[MBProgressHUD alloc] initWithView:self.view];
[self.navigationController.view addSubview:RootHud];
RootHud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"error"]];
// Set custom view mode
RootHud.mode = MBProgressHUDModeCustomView;
RootHud.delegate = self;
}
and use the [self presentViewController:modelViewController animated:YES completion:nil];
in a viewController class which inherits from rootViewController
i try to find the reason but failed. if this isn't a bug, i will try to check my code to find out where the nil comes from
I guess self.view
is nil when you call that initHUD
method.
thank you for your instructions
the program will break in this part, xcode says the view is nil
(id)initWithView:(UIView *)view {
NSAssert(view, @"View must not be nil.");
return [self initWithFrame:view.bounds]; }