Permalink
Browse files

Merge pull request #4 from DimaVartanian/master

changed name to avoid using language keyword "self". Fixed readme to reflect 2 block parameters.
  • Loading branch information...
2 parents 1a54554 + e393568 commit fa0e52a7b2c43ec58dec231828784bfb22924c5b @hsjunnesson committed Nov 15, 2013
Showing with 4 additions and 4 deletions.
  1. +3 −3 README.md
  2. +1 −1 UIView+DrawRectBlock.h
View
@@ -11,7 +11,7 @@ Something like this:
- (void)viewDidLoad {
[self.view addSubview:[UIView viewWithFrame:CGRectMake(20, 40, 60, 60)
- drawRectBlock:^(CGRect rect) {
+ drawRectBlock:^(UIView *drawRectView, CGRect rect) {
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(c, [UIColor blueColor].CGColor);
CGContextFillRect(c, rect);
@@ -23,7 +23,7 @@ Say you want to access a property on the viewcontroller, like that color, so you
- (void)viewDidLoad {
[self.view addSubview:[UIView viewWithFrame:CGRectMake(20, 40, 60, 60)
- drawRectBlock:^(CGRect rect) {
+ drawRectBlock:^(UIView *drawRectView, CGRect rect) {
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(c, self.fillColor.CGColor);
CGContextFillRect(c, rect);
@@ -37,7 +37,7 @@ If you're using iOS 5 and ARC, you can do something like this:
- (void)viewDidLoad {
__weak MyViewController *weakRef = self;
[self.view addSubview:[UIView viewWithFrame:CGRectMake(20, 40, 60, 60)
- drawRectBlock:^(CGRect rect) {
+ drawRectBlock:^(UIView *drawRectView, CGRect rect) {
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(c, weakRef.fillColor.CGColor);
CGContextFillRect(c, rect);
View
@@ -28,7 +28,7 @@
// DrawRect block typedef
-typedef void(^UIViewDrawRectBlock)(UIView *self, CGRect rect);
+typedef void(^UIViewDrawRectBlock)(UIView *drawRectView, CGRect rect);
@interface UIView (UIView_DrawRectBlock)

0 comments on commit fa0e52a

Please sign in to comment.