Skip to content

Commit 4bad539

Browse files
committed
finished tweaks connected with chapter 12
1 parent 1c83c62 commit 4bad539

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

bk2ch06p275tabbedInterface/ch19p611tabbedInterface/AppDelegate.swift

+9-18
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ class AppDelegate : UIResponder, UIApplicationDelegate {
3434
self.window!.tintColor = .red // prove that bar item tint color is inherited
3535

3636
UITabBarItem.appearance().setTitleTextAttributes([
37-
NSFontAttributeName:UIFont(name:"Avenir-Heavy", size:14)!
38-
],
39-
for:.normal)
40-
41-
// UIFont.familyNames()
42-
// .map{UIFont.fontNamesForFamilyName($0 as String)}.map(println)
37+
NSFontAttributeName:UIFont(name:"Avenir-Heavy", size:14)!,
38+
NSForegroundColorAttributeName:UIColor.green
39+
], for:.normal)
40+
// I am curious but yellow
41+
UITabBarItem.appearance().setTitleTextAttributes([
42+
NSFontAttributeName:UIFont(name:"Avenir-Heavy", size:14)!,
43+
NSForegroundColorAttributeName:UIColor.yellow
44+
], for:.selected)
4345

4446

47+
4548
let ding = UIFont(name:"ZapfDingbatsITC", size:40)!
4649
let r = UIGraphicsImageRenderer(size:CGSize(100,40))
4750
let im = r.image {
@@ -55,19 +58,7 @@ class AppDelegate : UIResponder, UIApplicationDelegate {
5558
NSParagraphStyleAttributeName:p,
5659
NSForegroundColorAttributeName:UIColor.red])
5760
}
58-
5961

60-
// UIGraphicsBeginImageContextWithOptions(CGSize(100,40), false, 0)
61-
// let s = "\u{2713}"
62-
// let p = NSMutableParagraphStyle()
63-
// p.alignment = .right
64-
// s.draw(in:CGRect(0,0,100,40),
65-
// withAttributes:[
66-
// NSFontAttributeName:ding,
67-
// NSParagraphStyleAttributeName:p,
68-
// NSForegroundColorAttributeName:UIColor.red()])
69-
// let im = UIGraphicsGetImageFromCurrentImageContext()!
70-
// UIGraphicsEndImageContext()
7162

7263
UITabBar.appearance().selectionIndicatorImage = im
7364

bk2ch12p602toolbarShadowBug/BarShadowTest/ViewController.swift

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class ViewController: UIViewController {
3434

3535
self.view.backgroundColor = .yellow
3636

37+
do {
38+
3739
let sz = CGSize(20,20)
3840
let r = UIGraphicsImageRenderer(size:sz)
3941

@@ -47,6 +49,8 @@ class ViewController: UIViewController {
4749
UIColor(white:0.95, alpha:0.85).setFill()
4850
UIGraphicsGetCurrentContext()!.fill(CGRect(0,0,20,20))
4951
}, forToolbarPosition:.any, barMetrics: .default)
52+
53+
}
5054

5155
do {
5256
let sz = CGSize(4,4)

0 commit comments

Comments
 (0)