MarioIannotta/MIResizableTableView


MIResizableTableView is a UITableView subclass that allows you to expand and contract its section.

Language: Objective-C

Keywords: customizable-tableview, objective-c, uitableview


MIResizableTableView

MIResizableTableView is a UITableView subclass that allows you to expand and contract its section.

Overview

If you're familiar with UITableView you can notice that MIResizableTableView provides very similar methods

// MIResizableTableViewDataSource
- (NSInteger)numberOfSectionsInResizableTableView:(MIResizableTableView *)resizableTableView;
- (NSInteger)resizableTableView:(MIResizableTableView *)resizableTableView numberOfRowsInSection:(NSInteger)section;

- (UIView *)resizableTableView:(MIResizableTableView *)resizableTableView viewForHeaderInSection:(NSInteger)section;
- (UITableViewCell *)resizableTableView:(MIResizableTableView *)resizableTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

// MIResizableTableViewDelegate
- (CGFloat)resizableTableView:(MIResizableTableView *)resizableTableView heightForHeaderInSection:(NSInteger)section;
- (CGFloat)resizableTableView:(MIResizableTableView *)resizableTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)resizableTableView:(MIResizableTableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

and here's the catch

- (UITableViewRowAnimation)resizableTableViewInsertRowAnimation;
- (UITableViewRowAnimation)resizableTableViewDeleteRowAnimation;

- (BOOL)resizableTableViewSectionShouldExpandSection:(NSInteger)section;

Setup

  • Add the MIResizableTableView to your project.
  • Declare the tableview you want to be resizable as MIResizableTableView.
  • Declare the MIResizableTableViewDataSource and the MIResizableTableViewDelegate.
  • In the ViewController's viewDidLoad call configureWithDelegate:andDataSource:.

Briefly here's how your ViewController should be.

@interface ViewController () <MIResizableTableViewDataSource, MIResizableTableViewDelegate>

@property (nonatomic, weak) IBOutlet MIResizableTableView *tableView;

// some other properties

@end

@implementation ViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    [self.tableView configureWithDelegate:self andDataSource:self];

    // do stuff
}

// your methods

@end

Demo

In this repository you can also find a demo.

Info

If you like this git you can follow me here or on twitter :) @MarioIannotta

Cheers from Italy!

Project Statistics

Sourcerank 4
Repository Size 7.63 MB
Stars 34
Forks 8
Watchers 3
Open issues 1
Dependencies 0
Contributors 1
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Mario Iannotta

Interesting Forks See all

mohsinalimat/MIResizableTableView
MIResizableTableView is a UITableView subclass that allows you to expand and contract its section.
Objective-C - Published - 1 stars

Something wrong with this page? Make a suggestion

Last synced: 2017-11-24 20:06:03 UTC

Login to resync this repository