ringa_lee2017-04-17 16:35:41
Swift:
let leftBtn = UIButton(type: UIButtonType.Custom)
leftBtn.frame = CGRectMake(0, 0, 65, 35)
leftBtn.setImage(UIImage(named: "icon_xm_homepage_downArrow"), forState: UIControlState.Normal)
leftBtn.adjustsImageWhenHighlighted = false
// leftBtn.setTitleColor(UIColor.brownColor(), forState: UIControlState.Normal) //Set button font color
leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignment.Center
leftBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -50, 0, 0)
leftBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 45, 0, 0)
leftBtn.setTitle("天津", forState: UIControlState.Normal)
leftBtn.addTarget(self, action: "showLeft", forControlEvents: UIControlEvents.TouchUpInside)
self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: leftBtn)
PHP中文网2017-04-17 16:35:41
Similar small icons generally have the following methods:
Use css sprites to set background-position to set this kind of small picture
Use an icon library, the more popular ones are Alibaba vector graphics library or bootstrap font icons
You can just write a caret-down class using css yourself
Meituan should use css sprites, which are relatively popular, have better compatibility and consume relatively less resources
大家讲道理2017-04-17 16:35:41
http://s1.meituan.net/www/css/si/base.v21effb81.png
Pictures, pick the one you like~