关闭

使用kxmenu时在UIBarButtonItem上frame无效

175人阅读 评论(0) 收藏 举报
分类:
UIBarButtonItem *addItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addBtnClicked:event:)];
    
    self.navigationItem.rightBarButtonItem = addItem;
//添加按钮点击触发事件,弹出下拉菜单
-(void)addBtnClicked:(UIBarButtonItem *)sender event:(UIEvent *) event
{
    NSArray *menuItems =
    @[
      
      [KxMenuItem menuItem:@"一键报送"
                     image:[UIImage imageNamed:@"导航栏-搜索"]
                     target:self
                    action:@selector(kxMenuClicked:)],
      
      [KxMenuItem menuItem:@"风险地图"
                     image:[UIImage imageNamed:@"导航栏-搜索"]
                     target:self
                     action:@selector(kxMenuClicked:)],
      
      [KxMenuItem menuItem:@"友情链接"
                     image:[UIImage imageNamed:@"导航栏-搜索"]
                     target:self
                     action:@selector(kxMenuClicked:)]
      ];
    
    CGRect fromRect = [[event.allTouches anyObject] view].frame;
    fromRect.origin.y += 20;

    [KxMenu setTitleFont:[UIFont systemFontOfSize:16]];
    [KxMenu showMenuInView:self.navigationController.navigationBar.superview
                  fromRect:fromRect
                 menuItems:menuItems];
}


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:154095次
    • 积分:2476
    • 等级:
    • 排名:第16708名
    • 原创:88篇
    • 转载:17篇
    • 译文:0篇
    • 评论:16条
    文章分类
    最新评论