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

The view isn't in the centre when in a VC that is presented modally or is the master/detail #23

Closed
Sweeper777 opened this issue Jun 30, 2016 · 8 comments

Comments

@Sweeper777
Copy link
Contributor

I tried to present an EZLoadingActivity in a Form Sheet view controller and it is off centred. It appears at about the bottom left corner of the form sheet. It isn't centred either when it is in a master-detail view controller.

To reproduce, create a view controller A in the storyboard. Add a button that triggers a segue like this:

screen shot 2016-06-30 at 5 06 53 pm

screen shot 2016-06-30 at 5 07 14 pm

Connect the segue to view controller B.

In view controller B viewDidLoad, show the EZLoadingActivity.

I think this is due to showing the view in the window. Can you do something about it so that it always appears centered in the current view controller?

@Esqarrouth
Copy link
Owner

Have you done any experiments with this?

What could be changed to make this work? Because I don't normally use storyboards I don't have good ideas to fix this.

@Sweeper777
Copy link
Contributor Author

Which view is the superview of EZLoadindActivity? You should set the superview of EZLoadingActivity to be the current view controller's view

@Esqarrouth
Copy link
Owner

In that case when you are loading something, and the view changes behind, there are bugs and weird stuff happening. If you can catch them and fix them then feel free to send a pull request

@Sweeper777
Copy link
Contributor Author

I fixed it! Since I am quite new to github, I don't know how to create a Pull Request. I'll tell you where to change.

In EZLoadingActivity.swift line 108:

center = CGPoint(x: UIScreen.mainScreen().bounds.midX, y: UIScreen.mainScreen().bounds.midY)

Change the above line to

center = CGPoint(x: topMostController!.view.bounds.midX, y: topMostController!.view.bounds.midY)

And it should work on modally presented view controllers now. For the master detail views, I haven't found a solution yet.

@Sweeper777
Copy link
Contributor Author

I forgot to mention, the midX in the above code comes from the midX implementation in EZSwiftExtensions.

@Esqarrouth
Copy link
Owner

Oh, you just go inside the file and click edit, then click the big button at bottom to send a pull request.

Will this affect normal loading activities? Which aren't presented modally?

Sweeper777 added a commit to Sweeper777/EZLoadingActivity that referenced this issue Jul 3, 2016
The EZLoadingActivity will now show in the center of modally presented view controllers.
@Sweeper777
Copy link
Contributor Author

Just in case you didn't get the notification for pull requests.

Esqarrouth added a commit that referenced this issue Jul 3, 2016
@Esqarrouth
Copy link
Owner

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

2 participants