Today's Menu
Portugal
journal and plan nutrition
|
#import <U3ParameterTableView.h>
Instance Methods | |
(id) | - initWithFrame:andComponents:inContainer: |
(void) | - addParameter: |
(void) | - updateParameter: |
(NSInteger) | - isListedAlready: |
(void) | - update: |
(float) | - getViewHeightReqmt |
(void) | - scrollInitially |
(void) | - scrollForControlPanel |
(void) | - scrollForInstructionPanel |
(NSUInteger) | - parameterCount |
(void) | - setViewForHead: |
(void) | - setViewForTail: |
(id) | - initWithFrame:andComponents:inContainer: [implementation] |
(void) | - setViewForHead: [implementation] |
(void) | - tableView:didSelectRowAtIndexPath: [implementation] |
(NSInteger) | - numberOfSectionsInTableView: [implementation] |
(NSInteger) | - tableView:numberOfRowsInSection: [implementation] |
(UITableViewCell *) | - tableView:cellForRowAtIndexPath: [implementation] |
(CGFloat) | - tableView:heightForHeaderInSection: [implementation] |
(UIView *) | - tableView:viewForHeaderInSection: [implementation] |
(CGFloat) | - tableView:heightForFooterInSection: [implementation] |
(UIView *) | - tableView:viewForFooterInSection: [implementation] |
Properties | |
NSMutableArray< NSDictionary * > * | givenParameters |
id< U3ParameterTableDelegate > | givenContainer |
TODO: Wrap the 'cell' in a class.
The key thing is that UIScrollView (from which UITableView inherits) messes around with the responder chain so as to always return itself in the UIView method HitTest: WithEvent: It is this method that proved to be the key to getting the scroll view to play ball. (Note: it is important NOT to implement the touchesBegan, etc methods in this subclass or else you will override the default scrolling behaviour.)
Therefore, it is vital to subclass the UITableView and override the HitTest: WithEvent method so that it returns the current UITableViewCell (which can be obtained by locating the cellAtPoint: UITableView method) unless you determine that there is some vertical finger movement or it is scrolling (i.e. where tableView.decelerating == NO), in which case return self.
The table cell itself also needs to be subclassed and all the UIResponder methods touchesBegan: , touchesMoved and touchesEnded methods must be implemented. There you can pass a method to determine whether there is any vertical movement and, if so, set the next responder to be the table view. It is also here where you implement the code to work the swiping action (Apple's example code in the Events handling guide works well here).
Then, it's just a case of cleaning up a little by resetting the various parameters in the touchesEnded method. I have a tick button on the left of my cell, so I made sure that the hitTest method in UITableView subclass always returned self if the touch.x position was < 50, but you get the gist.
It is important to make sure that the delaysContentTouches property of the UITableView is set to YES or else you won't get any scrolling. It is also a good idea to turn off the swipe editing gesture because it will interfere with the custom swiping action.
Attribution: https://forums.macrumors.com/threads/problems-accessing-touch-events-in-a-uitableview-uiscrollview.640508/
Definition at line 15 of file U3ParameterTableView.h.
- (void) addParameter: | (NSDictionary *) | newComponentSpecDict |
Definition at line 127 of file U3ParameterTableView.m.
- (float) getViewHeightReqmt |
Reimplemented in U3MenuChoicesTableView.
Definition at line 151 of file U3ParameterTableView.m.
- (id) initWithFrame: | (CGRect) | frame | |
andComponents: | (NSArray *) | components | |
inContainer: | (id< U3ParameterTableDelegate >) | container | |
|
implementation |
Definition at line 50 of file U3ParameterTableView.m.
- (NSInteger) isListedAlready: | (NSString *) | checkCaption |
Definition at line 111 of file U3ParameterTableView.m.
|
implementation |
Reimplemented in U3MenuChoicesTableView.
Definition at line 221 of file U3ParameterTableView.m.
- (NSUInteger) parameterCount |
Definition at line 207 of file U3ParameterTableView.m.
- (void) scrollForControlPanel |
Definition at line 174 of file U3ParameterTableView.m.
- (void) scrollForInstructionPanel |
Definition at line 182 of file U3ParameterTableView.m.
- (void) scrollInitially |
Definition at line 167 of file U3ParameterTableView.m.
- (void) setViewForHead: | (UIView *) | headView |
|
implementation |
Definition at line 77 of file U3ParameterTableView.m.
- (void) setViewForTail: | (UIView<Z6ContainedView> *) | tailView |
Definition at line 83 of file U3ParameterTableView.m.
|
implementation |
Reimplemented in U3MenuChoicesTableView.
Definition at line 235 of file U3ParameterTableView.m.
|
implementation |
Reimplemented in U3MenuChoicesTableView.
Definition at line 213 of file U3ParameterTableView.m.
|
implementation |
|
implementation |
|
implementation |
Reimplemented in U3MenuChoicesTableView.
Definition at line 227 of file U3ParameterTableView.m.
|
implementation |
|
implementation |
- (void) update: | (NSArray<NSDictionary *> *) | components |
Definition at line 94 of file U3ParameterTableView.m.
- (void) updateParameter: | (NSDictionary *) | newComponentSpecDict |
Definition at line 134 of file U3ParameterTableView.m.
|
readwritenonatomicstrong |
Definition at line 17 of file U3ParameterTableView.h.
|
readwritenonatomicstrong |
Definition at line 16 of file U3ParameterTableView.h.