Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit fa0e52a7b2c43ec58dec231828784bfb22924c5b 2 parents 1a54554 + e393568
@hsjunnesson authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 README.md
  2. +1 −1  UIView+DrawRectBlock.h
View
6 README.md
@@ -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
2  UIView+DrawRectBlock.h
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.