Skip to content

Commit ed2a405

Browse files
committed
add nib method
1 parent 193e0bd commit ed2a405

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

FEPopupMenuController/FEPopupMenuController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ - (void)viewDidLoad {
5050

5151
// init TableView
5252
self.tableView = [[UITableView alloc] initWithFrame:self.contentView.bounds];
53-
[self.tableView registerNib:[UINib nibWithNibName:@"FEPopupMenuItemCell" bundle:nil] forCellReuseIdentifier:[FEPopupMenuItemCell identifier]];
53+
[self.tableView registerNib:[FEPopupMenuItemCell nib] forCellReuseIdentifier:[FEPopupMenuItemCell identifier]];
5454
self.tableView.delegate = self;
5555
self.tableView.dataSource = self;
5656
self.tableView.separatorColor = [UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1];

FEPopupMenuController/FEPopupMenuItemCell.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
*/
3131
+ (NSString *)identifier;
3232

33+
/**
34+
* nib
35+
*/
36+
+ (UINib *)nib;
37+
3338
/**
3439
* fill the cell with item
3540
*/

FEPopupMenuController/FEPopupMenuItemCell.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ +(NSString *)identifier{
2525
return @"FEPopupMenuItemCell";
2626
}
2727

28+
+ (UINib *)nib{
29+
return [UINib nibWithNibName:[self identifier] bundle:[NSBundle bundleForClass:[self class]]];
30+
}
31+
2832
-(void)configCellWithItem:(FEPopupMenuItem *)item{
2933

3034
// Title

0 commit comments

Comments
 (0)