@@ -16,8 +16,8 @@ @interface FEPopupMenuController () <UITableViewDelegate,UITableViewDataSource,U
1616
1717@property (nonatomic , strong ) UIView *contentView;
1818@property (nonatomic , strong ) UITableView *tableView;
19-
2019@property (nonatomic , strong ) UITapGestureRecognizer *tapBackgroundGestureRecognizer;
20+
2121@end
2222
2323@implementation FEPopupMenuController
@@ -28,6 +28,8 @@ -(instancetype)initWithItems:(NSArray<FEPopupMenuItem *> *)items {
2828 self.automaticDismiss = YES ;
2929 self.contentViewWidth = kDefaultContentViewWidth ;
3030 self.contentViewPosition = CGPointMake (0 ,0 );
31+ self.contentViewBackgroundColor = [UIColor whiteColor ];
32+ self.contentViewCornerRadius = 8.0 ;
3133 }
3234 return self;
3335}
@@ -45,8 +47,11 @@ - (void)viewDidLoad {
4547 [self .view addGestureRecognizer: self .tapBackgroundGestureRecognizer];
4648
4749 // init contentView
48- self.contentView = [[UIView alloc ] initWithFrame: CGRectMake (self .contentViewPosition.x, self .contentViewPosition.y, self .contentViewWidth, 44 * [self .items count ])];
49- self.contentView .layer .cornerRadius = 8.0 ;
50+ self.contentView = [[UIView alloc ] initWithFrame: CGRectMake (self .contentViewPosition.x,
51+ self .contentViewPosition.y,
52+ self .contentViewWidth,
53+ 44 * [self .items count ])];
54+ self.contentView .layer .cornerRadius = self.contentViewCornerRadius ;
5055 self.contentView .clipsToBounds = YES ;
5156
5257 // init TableView
@@ -56,6 +61,7 @@ - (void)viewDidLoad {
5661 self.tableView .dataSource = self;
5762 self.tableView .separatorColor = [UIColor colorWithRed: 0.96 green: 0.96 blue: 0.96 alpha: 1 ];
5863 self.tableView .scrollEnabled = NO ;
64+ self.tableView .backgroundColor = self.contentViewBackgroundColor ;
5965
6066 if ([self .tableView respondsToSelector: @selector (setSeparatorInset: )]) {
6167 [self .tableView setSeparatorInset: UIEdgeInsetsZero];
@@ -71,11 +77,6 @@ - (void)viewDidLoad {
7177 [self .tableView reloadData ];
7278}
7379
74- - (void )didReceiveMemoryWarning {
75- [super didReceiveMemoryWarning ];
76- // Dispose of any resources that can be recreated.
77- }
78-
7980#pragma mark show & dismiss
8081
8182-(void )showInViewController : (UIViewController *)viewController atPosition : (CGPoint)position {
@@ -123,6 +124,12 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS
123124 FEPopupMenuItemCell *cell = [tableView dequeueReusableCellWithIdentifier: [FEPopupMenuItemCell identifier ]];
124125 FEPopupMenuItem *item = self.items [indexPath.row];
125126 [cell configCellWithItem: item];
127+
128+ // config
129+ if (self.itemTitleColor ) {
130+ cell.titleLabel .textColor = self.itemTitleColor ;
131+ }
132+
126133 return cell;
127134}
128135
0 commit comments