How to add UIView over navigation bar?

前端 未结 5 447
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 15:38

I need overlay UINavigationBar with UIView like here

\"http://screencast.com/t/ZKXNFcAzVu

5条回答
  •  面向向阳花
    2021-02-02 15:52

    Use the method :

    - (void)bringSubviewToFront:(UIView *)view
    

    So in your case that will be :

    [navigationBar addSubview:myRibbon];
    [navigationBar bringSubviewToFront:myRibbon];
    

    Also don't forget that with this way, your ribbon won't be showed completely except if you do this :

    navigationBar.clipsToBounds = NO;
    

提交回复
热议问题