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

Update shout view to increase larger touch area #132

Merged
merged 2 commits into from
Nov 22, 2016
Merged

Conversation

onmyway133
Copy link
Contributor

  • Remove gesture view
  • Add pan gesture to shout view
  • Add touch gesture to background view
  • Shout view height = background view height + Dimensions.touchOffset (40 for now)
  • Handle background view size and indicator view inside frame didSet, make it easy to reason about the code

shout

@mention-bot
Copy link

@onmyway133, thanks for your PR! By analyzing the history of the files in this pull request, we identified @RamonGilabert, @tkohout and @LucidityDesign to be potential reviewers.

[indicatorView, imageView, titleLabel, subtitleLabel, gestureContainer].forEach {
backgroundView.addSubview($0) }
[imageView, titleLabel, subtitleLabel, indicatorView].forEach {
$0.autoresizingMask = []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need autoresizing, so explicitly disable it

frame = CGRect(x: 0, y: 0, width: width, height: 0)
backgroundView.frame = CGRect(x: 0, y: 0, width: width, height: 0)

frame.size.height = 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset to 0 to make the animation happen

@@ -86,15 +79,18 @@ open class ShoutView: UIView {
open fileprivate(set) var completion: (() -> ())?

private var subtitleLabelOriginalHeight: CGFloat = 0
private var internalHeight: CGFloat = 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the height of the visible view

UIView.animate(withDuration: 0.2, animations: {
self.frame.size.height = height + Dimensions.touchOffset
}, completion: { _ in
if translation.y < -5 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each statement in each line

@onmyway133 onmyway133 merged commit f892ccf into master Nov 22, 2016
@onmyway133 onmyway133 deleted the fix/shout branch November 22, 2016 09:16
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

Successfully merging this pull request may close these issues.

None yet

3 participants