Open ezhes opened 8 years ago
Hello @shusain93 !
Could you show me where in your code you are calling the show
method, please?
It doesn't matter where I call it from the looks of it. I get this:
when I call it in my pulledToRefresh IBAction
@IBAction func pulledToRefersh(_ sender: AnyObject) {
KVNProgress.show(withStatus: "ASDASD", on: self.view)
}
Ok. And if you don't add the on
view parameter?
It works correctly/as expected. I'm trying to use the onView
so that It doesn't always block the whole view.
Ok, I will investigate that!
Could you print the type of self.view
?
self.view
is a UIView?
however even if I use on: self.view!
it still doesn't work. If I send my self.tableView
I also get the same issue.
And if you try in another view controller that is not backed by a tableview?
That's the bug right there! It seems that a UITableViewController
causes the issue because I believe that self.view
will return the tableview if it is a UITableViewController
Did you print the type of the view like this:
print(self.view)
print(self.view.type)
because I think that UITableViewController
has actually a UITableWrapperView
or something like that that have the UITableView
as child.
I used a breakpoint and used the object inspector. Using print(self.view.dynamicType)
I get ImplicitlyUnwrappedOptional<UIView>
and print(self.view)
I get <UITableView: 0x7c8ce200; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x7bfc6b30>; layer = <CALayer: 0x7bed7450>; contentOffset: {0, 0}; contentSize: {375, 0}>
So I'd assume that there is no wrapper. .type
no longer works in Swift 3.
Thanks. I think that adding a subview to a UITableView
is unadvised because it can trigger weird behaviours like this one. I'll check what can be done ;)
It seems that using Autolayout when adding a subview to a UITableView
is messing the subview. When adding the KVNProgress
to the view, I add the following constraints:
V:|[loader]|
H:|[loader]|
Commenting the related code gives the correct result:
I will see what I can do to fix this.
By putting the Autolayout code in an if
condition for UITableView
cases, it now works. The only thing you have to notice is that you can still scroll through your tableView if you do not prevent it:
I will check that nothing is broken before committing it 🙃
Ok, I made a commit on master 626b9a9 You can check it out and test it 😉 With CocoaPods, you can do:
pod 'KVNProgress', :git => 'https://github.com/AssistoLab/KVNProgress.git', :commit => '626b9a943d'
I wait for your feedback before closing this issue.
Thanks!
This works perfectly as long as every single other use of the progress spinner is also used with the on:
property. If you end up mixing them in the same view controller you end up breaking the whole shared object and so every time it presents using on:
it shows up like this:
and we are thrown an autolayout error in the console:
[LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x170099dc0 UIImageView:0x101127d10.width == - 50 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x170099dc0 UIImageView:0x101127d10.width == - 50 (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
edit: It doesn't seem like the on:
attribute is directly connected. I still see this issue after having fixed all of the occurrences.
Hello @shusain93!
So it works well, but not when you use the show
method without the on:
parameter? Could you be more precise, please? :)
I get this weird bug when I use this
KVNProgress.show(withStatus: message, on: self.view)
however without theon: self.view
it displays correctly. This could be an issue on my end and I'm trying to figure out if anyone else can reproduce.