How to type the "Dog Face" with a Mac?
Just select [control] + [command] + [space] in a text field.
Then select the Emoji as below:
This blog is about Apple's Swift programming language with iOS, Xcode, and iPhone.
Related Information: Electrical and Computer Engineering - StudyEECC
Biomedical Engineering -
StudyBME
Python - Study Raspberry Pi
Showing posts with label unicode. Show all posts
Showing posts with label unicode. Show all posts
Tuesday, June 28, 2016
Sunday, November 8, 2015
iOS Chinese font comparison: PingFang with various weights 以iOS程式顯示並比較六種不同粗細變化的「蘋方」字體
Update: August 3, 2017 (Swift 3.1 + Xcode 8.3.3)
Original Post: November 8, 2015 (Swift 2)
This post shows how to list the PingFang TC(Traditional Chinese) font with 6 different weights in a table for comparison.
蘋果公司於9月正式推出的iOS9及OS X 10.11 El Capitan (酋長巨石)中,新增了「蘋方」中文字型,有正體(TC)、香港(HK)及簡體(SC)三個版本,每個版本皆有6種不同的粗細變化。
以下的Swift程式以表格列出不同粗細的「蘋方」字體:
ViewController.swift
Update: August 3, 2017 (Swift 3.1 + Xcode 8.3.3)
Original Post: November 8, 2015 (Swift 2)
結果如下:
相關資訊:
在樹莓派上安裝中文字型 Install Chinese Fonts with Raspberry Pi
Google 推新版字體網站,共 804 字體供大家免費取用!
Google Fonts
解決字體顯示問題!蘋果、Google、微軟、Adobe 攜手開發字體(inside.com.tw)
Original Post: November 8, 2015 (Swift 2)
This post shows how to list the PingFang TC(Traditional Chinese) font with 6 different weights in a table for comparison.
蘋果公司於9月正式推出的iOS9及OS X 10.11 El Capitan (酋長巨石)中,新增了「蘋方」中文字型,有正體(TC)、香港(HK)及簡體(SC)三個版本,每個版本皆有6種不同的粗細變化。
以下的Swift程式以表格列出不同粗細的「蘋方」字體:
ViewController.swift
Update: August 3, 2017 (Swift 3.1 + Xcode 8.3.3)
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
//font names
let fontArray : [String] = [".PingFangTC-Ultralight",".PingFangTC-Thin",".PingFangTC-Light",".PingFangTC-Regular",".PingFangTC-Medium",".PingFangTC-Semibold"]
override func viewDidLoad() {
super.viewDidLoad()
let tableView = UITableView(frame: CGRect(x: 0, y: 50, width: view.bounds.width, height: view.bounds.height-50))
tableView.dataSource = self
tableView.delegate = self
//Do not draw line separators for empty cells.
tableView.tableFooterView = UIView()
view.addSubview(tableView)
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 6
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "myIdentifier")
cell.textLabel?.text = "蘋方字型測試 永 正體"
cell.textLabel?.font = UIFont(name: fontArray[indexPath.row], size: 28)
cell.textLabel?.textAlignment = NSTextAlignment.center
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Original Post: November 8, 2015 (Swift 2)
import UIKit
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
//font names
let fontArray : [String] = [".PingFangTC-Ultralight",".PingFangTC-Thin",".PingFangTC-Light",".PingFangTC-Regular",".PingFangTC-Medium",".PingFangTC-Semibold"]
override func viewDidLoad() {
super.viewDidLoad()
let tableView = UITableView(frame: CGRectMake(0, 50, view.bounds.width, view.bounds.height-50))
tableView.dataSource = self
tableView.delegate = self
//Do not draw line separators for empty cells.
tableView.tableFooterView = UIView()
view.addSubview(tableView)
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 6
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "myIdentifier")
cell.textLabel?.text = "蘋方字型測試 永 正體"
cell.textLabel?.font = UIFont(name: fontArray[indexPath.row], size: 30)
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
結果如下:
在樹莓派上安裝中文字型 Install Chinese Fonts with Raspberry Pi
Google 推新版字體網站,共 804 字體供大家免費取用!
Google Fonts
解決字體顯示問題!蘋果、Google、微軟、Adobe 攜手開發字體(inside.com.tw)
Sunday, October 11, 2015
Open the browser with a URL including Unicode characters 以瀏覽器開啟中文網址
The following example is written with Xcode 6.4. It converts a string with Unicode characters to the NSURL format.
Edit ViewController.swift as below:
Edit ViewController.swift as below:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let button = UIButton(frame: CGRectMake(100, 100, 100, 20))
button.setTitle("Press", forState: UIControlState.Normal)
button.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal)
button.setTitleColor(UIColor.cyanColor(), forState: UIControlState.Highlighted)//Set the title color while highlighted
button.addTarget(self, action: "btnPressed:", forControlEvents: UIControlEvents.TouchUpInside)
view.addSubview(button)
}
func btnPressed(sender: UIButton) {
println("btnPressed")
let string = "https://tw.news.yahoo.com/ios-9-0-1釋出-網友:滑臉書好快喔-083210396.html".stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())
let url = NSURL(string: string!)
UIApplication.sharedApplication().openURL(url!)//Open the URL in the browser.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
After pressing the 'Press' button, the browser is opened with the URL in Chinese.
Subscribe to:
Posts (Atom)

