Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a cell for the season episodes table view which delegates updatin…
…g of episode.seen to the controller when a checkbox is clicked.
- Loading branch information
Showing
6 changed files
with
79 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
@class Checkbox; | ||
@class Episode; | ||
|
||
@interface SeasonsEpisodeCell : UITableViewCell { | ||
Checkbox *checkbox; | ||
UILabel *titleLabel; | ||
} | ||
|
||
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier delegate:(id)delegate; | ||
- (void)updateCellWithEpisode:(Episode *)episode; | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#import "SeasonsEpisodeCell.h" | ||
#import "Checkbox.h" | ||
#import "Episode.h" | ||
|
||
@implementation SeasonsEpisodeCell | ||
|
||
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier delegate:(id)delegate { | ||
if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) { | ||
checkbox = [[Checkbox alloc] initWithFrame:CGRectMake(7, 7, 28, 28)]; | ||
[checkbox addTarget:delegate action:@selector(checkboxClicked:) forControlEvents:UIControlEventTouchUpInside]; | ||
[self.contentView addSubview:checkbox]; | ||
|
||
titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(42, 7, self.bounds.size.width - 42, 28)]; | ||
titleLabel.lineBreakMode = UILineBreakModeWordWrap; | ||
titleLabel.numberOfLines = 0; | ||
titleLabel.minimumFontSize = [UIFont systemFontSize]; | ||
titleLabel.font = [UIFont systemFontOfSize:[UIFont systemFontSize]]; | ||
[self.contentView addSubview:titleLabel]; | ||
} | ||
return self; | ||
} | ||
|
||
|
||
- (void)updateCellWithEpisode:(Episode *)episode { | ||
checkbox.selected = episode.seen; | ||
titleLabel.text = episode.title; | ||
} | ||
|
||
|
||
//- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
|
||
//[super setSelected:selected animated:animated]; | ||
|
||
//// Configure the view for the selected state. | ||
//} | ||
|
||
|
||
- (void)dealloc { | ||
[checkbox release]; | ||
[titleLabel release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@end |
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
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