Created
February 4, 2014 21:06
-
-
Save jchudzynski/8812384 to your computer and use it in GitHub Desktop.
Example of complete View Contr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AlbumListData.m | |
// Created by Janusz Chudzynski on 3/25/13 | |
#import "AlbumListData.h" | |
#import "Album.h" | |
@interface AlbumListData()<UITableViewDelegate, UITableViewDataSource> | |
@property (nonatomic,weak) UITableView * tableView; | |
@property (nonatomic,strong) NSArray * objects; | |
@end | |
@implementation AlbumListData | |
#pragma mark - Table view data source | |
// Return the number of sections. | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
return 1; | |
} | |
/* | |
Number of the rows in the section | |
*/ | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return self.objects.count; | |
} | |
/* | |
Controlling look of the cell | |
*/ | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"AlbumCell"]; | |
if(cell == nil) { | |
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"AlbumCell"]; | |
} | |
Album * album = (Album *)self.objects[indexPath.row]; | |
cell.textLabel.text =album.name; | |
cell.imageView.image = [UIImage imageNamed:@"albumSmallIcon"]; | |
return cell; | |
} | |
/* | |
Managing Selections | |
*/ | |
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment