我在UITableViewCell中使用MLKMenuPopover无法正常工作且显示不正确且无法正常工作
细胞分离器菜单上有一行
这是在自定义UITableViewCell
中为弹出窗口创建圆形按钮的代码 _btnDelete=[UIButton buttonWithType:UIButtonTypeCustom];
[_btnDelete setFrame:CGRectMake(DeviceWidth-30, 80, 20, 20)];
[_btnDelete setBackgroundImage:[UIImage imageNamed:@"edit_icon.png"] forState:UIControlStateNormal];
[_btnDelete addTarget:self action:@selector(btnRemoveClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:_btnDelete];
此操作也是自定义UITableViewCell
-(void)btnRemoveClicked:(id)sender{
if (self.delegate!=nil && [self.delegate respondsToSelector:@selector(delegatebtnAddressRemoveClicked:)]) {
[self.delegate delegatebtnAddressRemoveClicked:sender];
}
}
这是委托方法
-(void)delegatebtnRemoveClicked:(id)sender{
self.menuItems = [NSArray arrayWithObjects:@"REMOVE", nil];
NSLog(@"Button remove Clicked");
[self.menuPopover dismissMenuPopover];
self.menuPopover = [[MLKMenuPopover alloc] initWithFrame:MENU_POPOVER_FRAME menuItems:self.menuItems];
self.menuPopover.menuPopoverDelegate = self;
[self.menuPopover showInView:sender];
}