Closed Dysonapps closed 10 years ago
I have just tested installed the Applications sample project to an iOS7 device, and button touch events work properly here.
Can you show a "Color blended layers" preview of the render in the simulator? Specially to see the details of your empty dataset layout.
Something like this:
Also, are you returning YES for emptyDataSetShouldAllowTouch:
I am indeed returning YES but it turns out those delegate methods are never called. I've setup the delegate and copied the loadView method.
(BOOL)emptyDataSetShouldAllowTouch:(UIScrollView *)scrollView { NSLog(@"%@", NSStringFromSelector(_cmd));
return YES; }
(BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView {
return NO; }
Is your tableview conforming to both protocols?
self.tableView.emptyDataSetSource = self;
self.tableView.emptyDataSetDelegate = self;
Yep
(void)loadView { [super loadView];
self.tableView.emptyDataSetSource = self; self.tableView.emptyDataSetDelegate = self; self.tableView.tableFooterView = [UIView new]; }
I'd need to read more of your code to understand where's the problem. Please create a private gist of your view controller implementation and send it over to iromero@dzen.cl
Are you using the latest pod, version 1.3.2?
I am indeed.
Can you try not having an UIToolBar? By commenting
if ([self.navigationController isToolbarHidden] == YES) {
[self.navigationController setToolbarHidden:NO animated:NO];
}
I haven't tested this with that kind of layout. It may not make a difference. Just to know.
Tried that but made no difference unfortunately.
The setup seems to be ok. I've copy 'n pasted the methods you're implementing for displaying and interacting with the empty dataset, and it does work here:
There's probably something intercepting the touch input of the tableView. Does it scroll when empty?
I had it set to not scroll but if I change the following to YES, it does scroll properly.
I read your code over and over, and can't figure this out. Sorry. You'll need to dig into the DZNEmptyDataSet and log why the gesture and button are not being called.
I'd suggest to build a fresh new UITableViewController, only with the empty dataset setup, and see from there if it works. It must be something interfering...
Let me know if you find a solution.
No worries, just wanted you to be aware of it really, it's also evident in the 2 other view controllers I've used it in (same project). I can't understand why it's working for iOS 8 but not 7.x.
I haven't tested this library with iOS8 yet. Still, I've never encounter this bug before, and I'm using the library in 3 apps and 3 sample projects.
Have you tried the sample projects already? I hope you'll figure it out, and submit a PR if there's actually something wrong in the library. My guess is that there's something in your code interfering with touch input on the tableviews.
Yes, tried them and they all work fine. I'll keep plugging away.
Update:
The problem seems to be caused by the UISearchBar from a storyboard-created UISearchDisplayController.
When I remove the UISearchBar from the Storyboard, the button works correctly. Unless I'm misunderstanding, there's no way to remove the SearchBar from the search controller and re-add it unless you create a new search controller every time you want to re-enable search.
Any ideas for a possible work-around?
That's really weird. I've just updated the Colors sample project, which uses UISearchDisplayController with the normal UISearchBar, and couldn't reproduce the bug. Please take a look into it, and keep me posted.
Thanks
I've tested the issue against the Colors app and was able to recreate the problem.
All I did was add a UISearchDisplayController and its UISearchBar to the UITableView in the Storyboard.
The button doesn't register the tap events either.
The Search TVC works fine because you're modifying the searchResultsTableView instead of modifying a tableView who's controller also has a searchResultsController.
Solution:
In the colours app, add a UISearchDisplayController to the TableViewController class and the corresponding UISearchBar to the tableView in the Storyboard.
Change numberOfRows to
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger rowCount = [[Palette sharedPalette] colors].count;
if (rowCount < 1) { if (self.searchDisplayController.searchBar.superview) { [self.searchDisplayController.searchBar removeFromSuperview]; } }
else { if (!self.searchDisplayController.searchBar.superview) { [self.tableView addSubview:self.searchDisplayController.searchBar]; } }
return rowCount; }
This re-enables the button.
Fixed with #18
The buttons returned (shown) from
- (NSAttributedString *)buttonTitleForEmptyDataSet:(UIScrollView *)scrollView forState:(UIControlState)state;
aren't registering touch events. The button appears to be displayed properly but tapping them does nothing on devices running iOS 7.x using Xcode 5.1.1. However, the buttons are working properly in the iOS 8 betas.
Thanks, Wes