Quantcast
Channel: Change Default Scrolling Behavior of UITableView Section Header - Stack Overflow
Viewing all articles
Browse latest Browse all 20

Answer by marmor for Change Default Scrolling Behavior of UITableView Section Header

$
0
0

@LocoMike's answer best fitted my tableView, however it broke when using footers as well.So, this is the corrected solution when using headers and footers:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{    return (self.sections.count + 1) * 3;}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    if (section % 3 != 1) {        return 0;    }    section = section / 3;    ...}- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{    if (section % 3 != 0) {        return nil;    }    section = section / 3;    ...}- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{    if (section % 3 != 0) {        return 0;    }    section = section / 3;    ...}- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{    if (section % 3 != 2) {        return 0;    }    section = section / 3;    ...}- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{    if (section % 3 != 0) {        return nil;    }    section = section / 3;    ...}- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{    if (section % 3 != 2) {        return nil;    }    section = section / 3;    ...}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    int section = indexPath.section;    section = section / 3;    ...}

Viewing all articles
Browse latest Browse all 20

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>