Is the Bluetooth logo available as a character on iPhone?

Viewed 15833

Is there a font on iOS where there's a glyph for the Bluetooth logo? Some Dingbats, maybe, or Emoji? How about the WiFi logo?

EDIT: how about a third party font where there's such a character, the one that I could license and ship?

5 Answers

Using Quartz2D in Swift 4.1

If you hate using external fonts or adding a bunch of .png files, you may prefer a simple class to get the same effect using Quartz2D.

This works for me with a logo of 20x20 points. You may want to optimize the geometry or line width. Also note that the frame's width should be equal the height.

Note that you will need to use setNeedsDisplay if the size changes.

enter image description here

import UIKit
class BluetoothLogo: UIView {
    var color: UIColor!
    convenience init(withColor color: UIColor, andFrame frame: CGRect) {
        self.init(frame: frame)
        self.backgroundColor = .clear
        self.color = color
    }
    override func draw(_ rect: CGRect) {
        let context = UIGraphicsGetCurrentContext()
        let h = self.frame.height
        let y1 = h * 0.05
        let y2 = h * 0.25
        context?.move(to: CGPoint(x: y2, y: y2))
        context?.addLine(to: CGPoint(x: h - y2, y: h - y2))
        context?.addLine(to: CGPoint(x: h/2, y: h - y1))
        context?.addLine(to: CGPoint(x: h/2, y: y1))
        context?.addLine(to: CGPoint(x: h - y2, y: y2))
        context?.addLine(to: CGPoint(x: y2, y: h - y2))
        context?.setStrokeColor(color.cgColor)
        context?.setLineCap(.round)
        context?.setLineWidth(2)
        context?.strokePath()
    }
}
Related