Skip to content

Commit a4b5d4e

Browse files
committed
minor, function name change
1 parent ebfe2d2 commit a4b5d4e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

bk2ch12p606navigationBar/ch25p877navigationBar/ViewController.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
import UIKit
4-
func imageFromContextOfSize(size:CGSize, closure:() -> ()) -> UIImage {
4+
func imageOfSize(size:CGSize, closure:() -> ()) -> UIImage {
55
UIGraphicsBeginImageContextWithOptions(size, false, 0)
66
closure()
77
let result = UIGraphicsGetImageFromCurrentImageContext()
@@ -21,26 +21,25 @@ class ViewController: UIViewController {
2121
// very simple example
2222

2323
self.navbar.backIndicatorImage =
24-
imageFromContextOfSize(CGSizeMake(10,20)) {
24+
imageOfSize(CGSizeMake(10,20)) {
2525
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(6,0,4,20))
2626
}
2727
self.navbar.backIndicatorTransitionMaskImage =
28-
imageFromContextOfSize(CGSizeMake(10,20)) {
29-
}
28+
imageOfSize(CGSizeMake(10,20)) {}
3029

3130
// shadow, as in previous example
3231

3332
let sz = CGSizeMake(20,20)
3433

35-
self.navbar.setBackgroundImage(imageFromContextOfSize(sz) {
34+
self.navbar.setBackgroundImage(imageOfSize(sz) {
3635
UIColor(white:0.95, alpha:0.85).setFill()
3736
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,0,20,20))
3837
}, forBarPosition:.Any, barMetrics: .Default)
3938
self.navbar.translucent = true
4039

4140
let sz2 = CGSizeMake(4,4)
4241

43-
self.navbar.shadowImage = imageFromContextOfSize(sz2) {
42+
self.navbar.shadowImage = imageOfSize(sz2) {
4443
UIColor.grayColor().colorWithAlphaComponent(0.3).setFill()
4544
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,0,4,2))
4645
UIColor.grayColor().colorWithAlphaComponent(0.15).setFill()
@@ -57,7 +56,7 @@ class ViewController: UIViewController {
5756

5857
func pushNext(sender:AnyObject) {
5958
let oldb = sender as UIBarButtonItem
60-
let s = oldb.title;
59+
let s = oldb.title
6160
let ni = UINavigationItem(title:s)
6261
if s == "Evers" {
6362
let b = UIBarButtonItem(

0 commit comments

Comments
 (0)