Closed barankaansert closed 5 years ago
Don't you mind if creating or sending over an example project with the issue? I can help investigate and fix it from there.
Actually basicly in viewDidLoad:
UIAlertView(title: "title", message: "message", delegate: nil, cancelButtonTitle: nil).show()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
let loader = ActivityData(size: CGSize(width: 40, height: 40),
message: nil, messageFont: nil,
type: .circleStrokeSpin,
color: UIColor(red: 0.18, green: 0.72, blue: 0.93, alpha: 1.00),
padding: nil, displayTimeThreshold: nil,
minimumDisplayTime: 1,
backgroundColor: .clear,
textColor: nil)
NVActivityIndicatorPresenter.sharedInstance.startAnimating(loader, nil)
}
I checked the example, and the behavior seems different from what you described. The animation is hidden behind the alert view, yet it's still able to dismiss after stopAnimating()
. Here is the code I used.
UIAlertView(title: "title", message: "message", delegate: nil, cancelButtonTitle: "OK").show()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
let loader = ActivityData(size: CGSize(width: 40, height: 40),
message: nil,
messageFont: nil,
type: .circleStrokeSpin,
color: UIColor(red: 0.18, green: 0.72, blue: 0.93, alpha: 1.00),
padding: nil,
displayTimeThreshold: nil,
minimumDisplayTime: 1,
backgroundColor: .clear,
textColor: nil)
NVActivityIndicatorPresenter.sharedInstance.startAnimating(loader, nil)
}
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
NVActivityIndicatorPresenter.sharedInstance.stopAnimating()
}
Anyway, what use case are you having NVActivityIndicatorView
with UIAlertView
?
We are using fabric to distrubuting our Beta apps, so when new version is available on fabric, automatically appears "new version is available" alert on screen at old versions of app. App goes through to Main page and fetching some data and runs
NVActivityIndicatorPresenter.sharedInstance.startAnimating(loader, nil)
when UIAlertView on screen. After that
NVActivityIndicatorPresenter.sharedInstance.stopAnimating()
not works.
When i debug this stopAnimating, i found hide(_:) method in NVActivityIndicatorPresenter.
fileprivate func hide(_ fadeOutAnimation: FadeOutAnimation?) {
for window in UIApplication.shared.windows {
for item in window.subviews
where item.restorationIdentifier == restorationIdentifier {
if let fadeOutAnimation = fadeOutAnimation {
fadeOutAnimation(item) {
item.removeFromSuperview()
}
} else {
item.removeFromSuperview()
}
}
}
}
i think, every item is window.subviews has no restorationIdentifier with "NVActivityIndicatorViewContainer".
I hope it will helps to understant my problem. 🙏🏼
It might be a niche case to have 2 "modals" displaying at the same time. I'd suggest dismissing the alert view first, then startAnimating(_:, _:)
, it also gives better UX in my opinion. Since I can't reproduce this issue on my side, could you help check the following:
hide(_:)
at all?hide(_:)
, is there any view with restorationIdentifier
?startAnimating(_:, _:)
and stopAnimating(_:
), it might help.Close this, reopen if need be.
Hi,
Thanks for an excallent tool. I have one issue about dismissing the indicator view. When you show any UIAlertatew at screen before you startAnimating activity indictor, the activity indicator is not dismissable.
Could you please help me with this issue? @ninjaprox
Thanks.