Note that there are some explanatory texts on larger screens.

plurals
  1. POHide keyboard when scroll UITableView
    primarykey
    data
    text
    <p>In my app i want hide keyboard when i start scrolling UITableView. I search about this in internet, and most answer is subclassing UITableView (http://stackoverflow.com/questions/3499810/tapping-a-uiscrollview-to-hide-the-keyboard).</p> <p>I made subclass but it's dont work.</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @protocol MyUITableViewDelegate &lt;NSObject&gt; @optional - (void)myUITableViewTouchesBegan; @end @interface MyUITableView : UITableView &lt;UITableViewDelegate, UIScrollViewDelegate&gt; { id&lt;MyUITableViewDelegate&gt; delegate; } @end </code></pre> <p>.m file</p> <pre><code>#import "MyUITableView.h" @implementation MyUITableView - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ NSLog(@"delegate scrollView"); //this is dont'work [super scrollViewDidScroll:scrollView]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"delegate myUITableViewTouchesBegan"); // work only here [delegate myUITableViewTouchesBegan]; [super touchesBegan:touches withEvent:event]; } - (void)dealloc { ... </code></pre> <p>I use this class like this. But delegate function myUITableViewTouchesBegan don't work in ViewController</p> <p>.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "MyUITableView.h" @interface FirstViewController : UIViewController &lt;UITableViewDelegate, UISearchBarDelegate, MyUITableViewDelegate&gt; { MyUITableView *myTableView; UISearchBar *searchBar; } @property(nonatomic,retain) IBOutlet MyUITableView *myTableView; ... </code></pre> <p>.m</p> <pre><code>- (void) myUITableViewTouchesBegan{ NSLog(@"myUITableViewTouchesBegan"); [searchBar resignFirstResponder]; } </code></pre> <p>I have some troubles with this implemenation:<br /> 1) myUITableViewTouchesBegan dont work in ViewController<br /> 2) NSLog from MyUITableView.m - <i>NSLog(@"delegate myUITableViewTouchesBegan");</i> work only when i touch table. How made it's work also when i start scrolling? <br /> I try override scrollViewDidScroll but comiler said that MyUITableVIew may be don't respond on this string <i>[super scrollViewDidScroll:scrollView]; </i></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload