Skip to content

Commit ebfe2d2

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

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bk2ch12p602toolbarShadowBug/BarShadowTest/ViewController.swift

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

22
import UIKit
3-
func imageFromContextOfSize(size:CGSize, closure:() -> ()) -> UIImage {
3+
func imageOfSize(size:CGSize, closure:() -> ()) -> UIImage {
44
UIGraphicsBeginImageContextWithOptions(size, false, 0)
55
closure()
66
let result = UIGraphicsGetImageFromCurrentImageContext()
@@ -20,27 +20,27 @@ class ViewController: UIViewController {
2020

2121
let sz = CGSizeMake(20,20)
2222

23-
self.navbar.setBackgroundImage(imageFromContextOfSize(sz) {
23+
self.navbar.setBackgroundImage(imageOfSize(sz) {
2424
UIColor(white:0.95, alpha:0.85).setFill()
2525
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,0,20,20))
2626
}, forBarPosition:.Any, barMetrics: .Default)
2727
self.navbar.translucent = true
2828

29-
self.toolbar.setBackgroundImage(imageFromContextOfSize(sz) {
29+
self.toolbar.setBackgroundImage(imageOfSize(sz) {
3030
UIColor(white:0.95, alpha:0.85).setFill()
3131
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,0,20,20))
3232
}, forToolbarPosition:.Any, barMetrics: .Default)
3333
self.navbar.translucent = true
3434

3535
let sz2 = CGSizeMake(4,4)
3636

37-
self.navbar.shadowImage = imageFromContextOfSize(sz2) {
37+
self.navbar.shadowImage = imageOfSize(sz2) {
3838
UIColor.grayColor().colorWithAlphaComponent(0.3).setFill()
3939
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,0,4,2))
4040
UIColor.grayColor().colorWithAlphaComponent(0.15).setFill()
4141
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,2,4,2))
4242
}
43-
self.toolbar.setShadowImage( imageFromContextOfSize(sz2) {
43+
self.toolbar.setShadowImage( imageOfSize(sz2) {
4444
UIColor.grayColor().colorWithAlphaComponent(0.3).setFill()
4545
CGContextFillRect(UIGraphicsGetCurrentContext(), CGRectMake(0,2,4,2))
4646
UIColor.grayColor().colorWithAlphaComponent(0.15).setFill()

0 commit comments

Comments
 (0)