调整导航按钮的布局

HPTopImgButton *topImgBtn = [[HPTopImgButton alloc] initWithFrame:CGRectMake(0, 0, 44, 30)];
    [topImgBtn setImage:[UIImage imageNamed:@"business_classificationwhite_default.png"] forState:UIControlStateNormal];
    [topImgBtn setTitle:@"分类" forState:UIControlStateNormal];
    [topImgBtn addTarget:self action:@selector(goGoodsTypeSearch:) forControlEvents:UIControlEventTouchUpInside];
    topImgBtn.titleLabel.font = [UIFont systemFontOfSize:[HbbUIStyleHelper fontSizeWithKey:kHbbUIStyleFontSizeStyleSmallSmallFontSize]];
    
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:topImgBtn];
    item.width = -16;
    //为了向左移动移动16个像素, 所以创建多了这个item
    UIBarButtonItem *sepaItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    sepaItem.width = -16;
    searchVC.navigationItem.leftBarButtonItems = @[sepaItem, item];

 

posted @ 2016-12-21 14:47  apem  阅读(185)  评论(0编辑  收藏  举报