CatNiP -test sprint-4-interim
catnip
PlaylistsDelegateDataSource Class Reference

#import <PlaylistsDelegateDataSource.h>

List of all members.

Public Member Functions

(id) - initWithMaster:
(NSInteger) - numberOfSectionsInTableView:
(void) - tableView:moveRowAtIndexPath:toIndexPath:
(BOOL) - tableView:canMoveRowAtIndexPath:
(NSInteger) - tableView:numberOfRowsInSection:
(UITableViewCell *) - tableView:cellForRowAtIndexPath:
(BOOL) - tableView:canEditRowAtIndexPath:
(void) - tableView:commitEditingStyle:forRowAtIndexPath:
(UITableViewCell *) - createTableCellLeft:
(UITableViewCell *) - createTableCellRight:
(void) - tableView:didSelectRowAtIndexPath:
(CGFloat) - tableView:heightForRowAtIndexPath:
(UITableViewCellEditingStyle) - tableView:editingStyleForRowAtIndexPath:
(void) - didSelectRowAtLeftTable:
(void) - didSelectRowAtRightTable:
(void) - changeLibraryTypeToPlaylists

Protected Attributes

CatNiPViewControllermaster

Properties

IBOutlet CatNiPViewControllermaster
NSMutableArray * playlists
NSMutableArray * scores

Member Function Documentation

- (void) changeLibraryTypeToPlaylists
- (UITableViewCell *) createTableCellLeft: (NSIndexPath *)  indexPath

Creates cell for libraryTableViewLeft.

Creates standard cell for application and assigns cell.textLabel.text = [[playlists objectAtIndex:(indexPath.row -1)] name].

Parameters:
createTableCellLeftUITableView which cells are generated in this function
Returns:
UITableViewCell for given parametres
- (UITableViewCell *) createTableCellRight: (NSIndexPath *)  indexPath

Creates cell for libraryTableViewRight.

Creates standard cell for application and sets it's showsReorderContor to NO if cell is "Add new score" otherwise sets it to YES;

Parameters:
createTableCellRightUITableView which cells are generated in this function
Returns:
UITableViewCell for given parametres
- (void) didSelectRowAtLeftTable: (NSIndexPath *)  indexPath

Shows libraryTableViewRight if hidden and reloads it's data.

Parameters:
didSelectRowAtLeftTablelocating the new selected row
- (void) didSelectRowAtRightTable: (NSIndexPath *)  indexPath

libraryTableViewRight's implementation of tableView: indexPath.

Using gesture recognizer initialized in viewDidLoad instead to prevent popping ScorePopoverController in new UIPopoverController with every search in libraryTableViewRight.

Parameters:
didSelectRowAtRightTablelocating the new selected row in tableView
- (id) initWithMaster: (CatNiPViewController *)  m
- (NSInteger) numberOfSectionsInTableView: (UITableView *)  tableView

UITableViewDataSource protocol function's dummy implementation.

Parameters:
numberOfSectionsInTableView
Returns:
value 1 cause each tableView has one section
- (BOOL) tableView: (UITableView *)  tableView
canEditRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource function's implementation

Everything is editable if LIBRARYTYPE == PLAYLISTS

Parameters:
tableViewlibraryTableViewRight or libraryTableViewLeft
canEditRowAtIndexPathindexPath to cell in tableView
Returns:
YES
- (BOOL) tableView: (UITableView *)  tableView
canMoveRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDataSource function's implementation

Playlists are kept in order with sorting thus libraryTableViewLeft's cells are not movable. libraryTableViewRight's cells except "Add new score" can be moved around each other.

Parameters:
tableViewlibraryTableViewRight
canMoveRowAtIndexPathindexPath to cell in tableView
Returns:
YES if tableView == libraryTableViewRight. Otherwise returns NO.
- (UITableViewCell *) tableView: (UITableView *)  tableView
cellForRowAtIndexPath: (NSIndexPath *)  indexPath 

Mandatory UITableViewDataSource function's implementation

Calls createTableCellLeft or createTableCellRight to create a cell to return

Parameters:
tableViewlibraryTableViewLeft or libraryTableViewRight
cellForRowAtIndexPathindexPath for cell to be created in tableView
Returns:
UITableViewCell for given parametres
- (void) tableView: (UITableView *)  tableView
commitEditingStyle: (UITableViewCellEditingStyle)  editingStyle
forRowAtIndexPath: (NSIndexPath *)  indexPath 
- (void) tableView: (UITableView *)  tableView
didSelectRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Calls spesified tableView's handler to determine behaviour. Check framework's API for details.

Parameters:
tableViewobject informing the delegate about the new row selection.
didSelectRowAtIndexPathlocating the new selected row in tableView
- (UITableViewCellEditingStyle) tableView: (UITableView *)  tableView
editingStyleForRowAtIndexPath: (NSIndexPath *)  indexPath 
- (CGFloat) tableView: (UITableView *)  tableView
heightForRowAtIndexPath: (NSIndexPath *)  indexPath 

UITableViewDelegate protocol function's implementation.

Calculate table's row height dynamically based on cell.textLabel.text length. Height is calculated with following formula: (([cell.textLabel.text length] / 34) * 17) + 50

Parameters:
tableViewfor which the height is calculated
heightForRowAtIndexPaththe row for which the height is calculated
Returns:
row's height in CGFloat type
- (void) tableView: (UITableView *)  tableView
moveRowAtIndexPath: (NSIndexPath *)  fromIndexPath
toIndexPath: (NSIndexPath *)  toIndexPath 

UITableViewDataSource function's implementation

Playlists are kept in order with sorting thus libraryTableViewLeft's cells are not movable. libraryTableViewRight's cells except "Add new score" can be moved around each other.

Parameters:
tableView,:libraryTableViewLeft or libraryTableViewRight
moveRowAtIndexPathindexPath from which the cell is moved
toIndexPathindexPath where the cell is moved
- (NSInteger) tableView: (UITableView *)  tableView
numberOfRowsInSection: (NSInteger)  section 

Mandatory UITableViewDataSource protocol function's implementation.

placeholder function for prototype

Parameters:
tableView
numberOfRowsInSection
Returns:
playlists or scores depending on which libraryTableView is chosen

Member Data Documentation

- (CatNiPViewController*) master [protected]

Property Documentation

- (IBOutlet CatNiPViewController*) master [read, write, retain]
- (NSMutableArray *) playlists [read, write, copy]
- (NSMutableArray *) scores [read, write, copy]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Properties Defines