iOS : How to add Underline in UITabBarItem

后端 未结 5 1597
情书的邮戳
情书的邮戳 2021-02-09 14:36

I am working in a application where i need to add underline in UITabbarItem.

so i would like to add underline under the selected UITabbarItem i

5条回答
  •  一个人的身影
    2021-02-09 14:52

    Use this code to add a bottom border to any UIView object, just replace view with your UITabbarItem object:

    CALayer *bottomBorder = [CALayer layer];
    bottomBorder.frame = CGRectMake(0, view.frame.size.height - 1, view.frame.size.width - 1, 1);
    bottomBorder.backgroundColor = [UIColor lightGrayColor].CGColor;
    [view.layer addSublayer:bottomBorder];
    

提交回复
热议问题