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

Add centered key with bool value in config.json file #195

Open
oboujaouane opened this issue Nov 28, 2018 · 1 comment
Open

Add centered key with bool value in config.json file #195

oboujaouane opened this issue Nov 28, 2018 · 1 comment

Comments

@oboujaouane
Copy link

oboujaouane commented Nov 28, 2018

Hi,

First thank you for your job!

Please can you in the next release add key "centered" for an element which is a bool value with false by default and if you set it to true in .json config file then your element is centered horizontally ?

In fact I was unable to center my play button in my bottom bar without this parameter :(

I made changes quickly in my local project and it's work perfectly. You can see the final result on simulator iPhone XS Max on iOS 12.1 :

bottom_button_centered_horizontally

In my VideoPlayer.json config file I can add this key "centered". An example:

"bottomBar": {
"backgroundColor": ["#ffffff"],
"height": 65,
"elements": [
{
"type": "toggleButton",
"identifier": "play",
"height": 65,
"image": "video_player_play_button",
"toggledImage": "video_player_pause_button",
"centered": true
}
]
}

Don't hesitate if I can help.

Thanks.

@oboujaouane
Copy link
Author

I modified a little part of the code in Bar.swift file to this with adding if else condition:

// Position them.
var left = CGFloat(0)
for element in elements {
  if element.centered == true {
    element.view.center.x = center.x
  } else {
    left += element.marginLeft
    element.view.frame.origin = CGPoint(x: left, y: (size.height - element.view.frame.size.height) / 2)
    left += element.view.frame.size.width + element.marginRight
  }
}

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

1 participant