使用kxmenu时在UIBarButtonItem上frame无效

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];
}


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xttxqjfg/article/details/71526136
个人分类: Object-C
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭