MBProgressHUD in UISplitViewController
I have a MBProgressHUD that is shown in the detailViewController of the UISplitViewApplication. It initially worked just fine when you start in either orientation. But once I change the orientation from landscape to portrait or vice versa, the view gets very messy. The code I did was:
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
This is defined in the viewDidLoad. Has anyone successfully get around with this orientati开发者_开发技巧on issue?
Make sure you are using the latest version available (v0.4), then use the following:
// Should be initialized with the windows frame so the HUD disables all user input by covering the entire screen
HUD = [[MBProgressHUD alloc] initWithWindow:[UIApplication sharedApplication].keyWindow
// Add HUD to screen
[self.view.window addSubview:HUD];
MBProgressHUD
is just not made to change orientation when showing.
You can use my fork of SVProgressHUD that will handle it just has you wanted.
Im having no problems with the MBProgressHUD when i change the orientation, this is how i use it.
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.labelText = @"Please wait..";
HUD.detailsLabelText = @"Getting data";
[HUD showWhileExecuting:@selector(thefunction) onTarget:self withObject:nil animated:YES];
I was able to resolve this by release-allocating the HUD when an orientation change. My issue is that the layout of the HUD in a split view controller is not correct. The black background and the indicator is separated when you switch views. So this is how I solve it.
精彩评论