Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Toggling a section's visibility #434

Open
jeffleeismyhero opened this issue Jun 27, 2015 · 1 comment
Open

Toggling a section's visibility #434

jeffleeismyhero opened this issue Jun 27, 2015 · 1 comment

Comments

@jeffleeismyhero
Copy link
Collaborator

I can hide a section with:

FORMTarget *target = [FORMTarget hideSectionTargetWithID:@"discounts-section"];
[self.dataSource processTargets:@[target]];

Similarly, I can show a section with:

FORMTarget *target = [FORMTarget showSectionTargetWithID:@"discounts-section"];
[self.dataSource processTargets:@[target]];

How can I determine if a section is hidden or visible? I want a button that will toggle the section to display or hide.

Additionally, how can I mark sections as hidden initially without resorting to the code above? That doesn't currently seem to be supported.

@3lvis
Copy link
Owner

3lvis commented Nov 4, 2015

We could do something like we do with fields. A method that takes a boolean to consider or exclude hidden values.

https://github.com/hyperoslo/Form/blob/master/Source/FORMDataSource.h#L193-L194

/*!
 * @discussion A method to find a @c field with its specific @c indexPath
 * @param fieldID The identifier for the field
 * @param includingHiddenFields A flag for whether look for hidden or collapsed fields or not
 */
- (void)fieldWithID:(NSString *)fieldID
includingHiddenFields:(BOOL)includingHiddenFields
         completion:(void (^)(FORMField *field,
                              NSIndexPath *indexPath))completion;

@3lvis 3lvis self-assigned this May 3, 2016
@3lvis 3lvis removed their assignment Jan 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants