导航栏上的item的位置设置

 /**
     leftItem
     */
    UIButton *leftbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    [leftbtn setImage:[UIImage imageNamed:@"public_back_n"] forState:UIControlStateNormal];
    [leftbtn addTarget:self action:@selector(clickBackItem) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftbtn];
    UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    negativeSpacer.width = 40;// 右移  负左移
    self.navigationItem.leftBarButtonItems = @[negativeSpacer,self.navigationItem.leftBarButtonItem];
    
    /**
     rightItem
     */
    UIButton *rightbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    [rightbtn setImage:[UIImage imageNamed:@"public_appraise_icon"] forState:UIControlStateNormal];
    [rightbtn addTarget:self action:@selector(clickBackItem1) forControlEvents:UIControlEventTouchUpInside];
    
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightbtn];
    UIBarButtonItem *rightnegativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
    rightnegativeSpacer.width = 40; //左移  负右移
    self.navigationItem.rightBarButtonItems = @[rightnegativeSpacer,self.navigationItem.rightBarButtonItem];
    
原文地址:https://www.cnblogs.com/liuwenqiang/p/7441729.html