My UINavigationitem's TitleView getting expanded in ios 6

前端 未结 2 601
隐瞒了意图╮
隐瞒了意图╮ 2021-01-19 09:58

In my app I have applied an image on uinavigation item. It is running fine in iOS 5 but getting expanded on iOS 6. I have no left or right bar button item in navigation bar.

2条回答
  •  迷失自我
    2021-01-19 10:16

    I have the same issue starting at iOS 6, and found the craziest workaround:

    Create one more UIImageView of the same dimension. Then add the navigationImage as a subview to that. In my case this will prevent the auto resizing.

    UIImageView *workaroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 98, 34)];
    [workaroundImageView addSubview:navigationImage];
    self.navigationItem.titleView=workaroundImageView;
    

    If anyone finds a proper solution or an explanation please post it.

提交回复
热议问题