rahuliyer95 / iShowcase

Highlight the best parts of your application
MIT License
65 stars 25 forks source link

Rotation - not updating size #6

Closed AileenMoreno closed 8 years ago

AileenMoreno commented 8 years ago

The iShowcase is not autoresizing when apps performs a rotation. So if the app is displaying a portrait showcase and a rotation to Landscape is perform the view is too short to fill the screen 's width

rahuliyer95 commented 8 years ago

Working on it, will need a lot of changes though

rahuliyer95 commented 8 years ago

Please check the rotation-support branch

AileenMoreno commented 8 years ago

Still not working. You should test it on an iPad. I have tried adding autolayout to the view and subviews using Cartography pod. The problem is to recalculate the clear area after the layout.

rahuliyer95 commented 8 years ago

If you could try the example application on the iPad it would help as rotation was working for me with the example application.

AileenMoreno commented 8 years ago

I'm sorry, i am using ipad 2 (9.3) simulator. Its your update example what i was running. Look :

2016-07-25 11:02 GMT-04:30 Rahul Iyer notifications@github.com:

If you could try the example application on the iPad it would help as rotation was working for me with the example application.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rahuliyer95/iShowcase/issues/6#issuecomment-234989168, or mute the thread https://github.com/notifications/unsubscribe-auth/AIfVN1HtkF8zNWqwDj7YHJbBe3qb8unwks5qZNcIgaJpZM4JQ3dX .

Aileen Moreno < aileenmoreno@hotmail.com >

rahuliyer95 commented 8 years ago

do try now

AileenMoreno commented 8 years ago

Thanks.

It works.

I have added a method to the delegate, so when the user tap and dismiss the view the location where it was tapped can be known.

private func getGestureRecgonizer() -> UIGestureRecognizer {

let singleTap = UITapGestureRecognizer(target: self, action: #selector(

showcaseTapped(_:)))

singleTap.numberOfTapsRequired = 1

singleTap.numberOfTouchesRequired = 1

return singleTap

}

internal func showcaseTapped(gestureRecognizer: UITapGestureRecognizer) {

let location = gestureRecognizer.locationInView(containerView.superview)

UIView.animateWithDuration(

  0.5,

  animations: { () -> Void in

    self.alpha = 0

}) { (_) -> Void in

  self.onAnimationComplete(location)

}

}

private func onAnimationComplete(touchLocation:CGPoint) {

if singleShotId != -1 {

  NSUserDefaults.standardUserDefaults().setBool(true, forKey:

String(format: "iShowcase-%ld", singleShotId))

  singleShotId = -1

}

for view in self.containerView.subviews {

  view.userInteractionEnabled = true

}

recycleViews()

self.removeFromSuperview()

if let delegate = delegate {

  delegate.iShowcaseDismissed?(self, location: touchLocation)

}

}

Thanks.

Bye

2016-07-25 14:34 GMT-04:30 Rahul Iyer notifications@github.com:

do try now

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rahuliyer95/iShowcase/issues/6#issuecomment-235051942, or mute the thread https://github.com/notifications/unsubscribe-auth/AIfVNwct6jT1iEngPvSk72qttWzytbDYks5qZQjOgaJpZM4JQ3dX .

Aileen Moreno < aileenmoreno@hotmail.com >