Customize navigation bar with title view

前端 未结 8 2317
一生所求
一生所求 2020-12-08 13:41

I am trying to add a custom view in the center of a navigation bar and I am using the following code to test it:

UIView * testView = [[UIView alloc] init];
[         


        
8条回答
  •  不知归路
    2020-12-08 14:25

    This works. Give frame at the time of initialisation

     UIView *iv = [[UIView alloc] initWithFrame:CGRectMake(0,0,32,32)];
     [iv setBackgroundColor:[UIColor whiteColor]];
      self.navigationItem.titleView = iv;
    

提交回复
热议问题