Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center not work #3

Closed
SadhuRus opened this issue Jul 1, 2015 · 6 comments
Closed

Center not work #3

SadhuRus opened this issue Jul 1, 2015 · 6 comments

Comments

@SadhuRus
Copy link

SadhuRus commented Jul 1, 2015

I Love MZFormSheetPresentationController !!! =)

But I was not happy with the location of the Pop-up'a. It is located just below the Navigation Controller'a. All attempts to move it to the center of the screen does not lead to any success.

My code:

LikeChoiceNavigationController *choiceNavigationController = [STORYBOARD instantiateViewControllerWithIdentifier:@"LikeChoiceNavigationController"];

MZFormSheetPresentationController *formSheetController = [[MZFormSheetPresentationController alloc] initWithContentViewController:choiceNavigationController];

formSheetController.contentViewSize = CGSizeMake(280, 320);
formSheetController.shouldDismissOnBackgroundViewTap = YES;
formSheetController.shouldCenterVertically = YES;
formSheetController.contentViewControllerTransitionStyle = MZFormSheetTransitionStyleBounce;

[navigationController presentViewController:formSheetController animated:YES completion:nil];
@m1entus
Copy link
Owner

m1entus commented Jul 1, 2015

If you open example you will see that it is wokring, make sure that movementActionWhenKeyboardAppears you have set to MZFormSheetActionWhenKeyboardAppearsDoNothing

@SadhuRus
Copy link
Author

SadhuRus commented Jul 1, 2015

I try it. But not work.

In the example, it is also no longer work if you delete the line:
presentedViewController.textFieldBecomeFirstResponder = YES;

I want to use a pop-up window without TextField.

@SadhuRus
Copy link
Author

SadhuRus commented Jul 1, 2015

I change you default code and now it work for me:

@autoreleasepool {
    MZFormSheetPresentationController *appearance = [self appearance];
    [appearance setContentViewSize:CGSizeMake(284.0, 284.0)];
    [appearance setPortraitTopInset:66.0];
    [appearance setLandscapeTopInset:6.0];
    [appearance setContentViewCornerRadius:5.0];
    [appearance setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.5]];
    [appearance setShouldCenterVertically:YES];
    [appearance setBlurEffectStyle:UIBlurEffectStyleLight];
    [appearance setMovementActionWhenKeyboardAppears:MZFormSheetActionWhenKeyboardAppearsDoNothing];
}

P.S: I Added this line in +(void)load:

[appearance setShouldCenterVertically:YES];

@SadhuRus SadhuRus closed this as completed Jul 1, 2015
@lumucheng
Copy link

hi, i'm also facing the issue where the shouldCenterVertically does not work unless the software keyboard is being triggered.

Any solutions without directly modifying the source files?

@lumucheng
Copy link

I just found a solution for this; You need to specify .shouldCenterVertically before setting the contentViewSize.

i.e instead of:

let formSheet = MZFormSheetPresentationController(contentViewController: viewController)
formSheet.contentViewSize = CGSizeMake(280.0, 280.0)
formSheet.contentViewControllerTransitionStyle = .StyleFade
formSheet.shouldDismissOnBackgroundViewTap = true
formSheet.shouldCenterVertically = true

do this

let formSheet = MZFormSheetPresentationController(contentViewController: viewController)
formSheet.shouldCenterVertically = true
formSheet.contentViewSize = CGSizeMake(280.0, 280.0)
formSheet.contentViewControllerTransitionStyle = .StyleFade
formSheet.shouldDismissOnBackgroundViewTap = true

@m1entus m1entus reopened this Jul 7, 2015
m1entus added a commit that referenced this issue Jul 7, 2015
@m1entus m1entus closed this as completed Jul 7, 2015
@klauslanza
Copy link

Is it possible to set the controller position like the old version? I'd like it to be near the right edge of the screen (not useful on iphone but on ipad a lot!)

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants