Can't set titleView in the center of navigation bar because back button

前端 未结 10 1561
情话喂你
情话喂你 2020-12-08 02:25

I\'m using an image view to display an image in my nav bar. The problem is that I can\'t set it to the center correctly because of the back button. I checked the related que

10条回答
  •  长情又很酷
    2020-12-08 02:52

    I suggest you Override the function - (void)setFrame:(CGRect)fram like this:

    - (void)setFrame:(CGRect)frame  { 
    
        [super setFrame:frame]; //systom function
    
        self.center = CGPointMake(self.superview.center.x, self.center.y);   //rewrite function 
    
    }
    

    so that the titleView.center always the right location

提交回复
热议问题