adit
adit

Reputation: 33644

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 orientation issue?

Upvotes: 1

Views: 1279

Answers (4)

adit
adit

Reputation: 33644

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.

Upvotes: 0

Massimo Cafaro
Massimo Cafaro

Reputation: 25419

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];

Upvotes: 3

Emre Akman
Emre Akman

Reputation: 1213

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];

Upvotes: 0

gcamp
gcamp

Reputation: 14662

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.

Upvotes: 1

Related Questions