How to give UIWebView Rounded Corners and a Shadow
If you would like to give your UIWebView rounded corners, you can find several recipes on the web, all ending up in this code snippet:
webView_.layer.cornerRadius = 10;
webView_.clipsToBounds = YES;
This will produce a nice rounded corner web view like in the picture below.
Everything wonderful. Now, what about a shadow below the web view? Would not it be even more beautiful? So, let’s tweak further the CALayer associated to the web view so that we can get a shadow almost for free (courtesy of Mike Nachbaur):
webView_.layer.shadowColor = [UIColor blackColor].CGColor;
webView_.layer.shadowOpacity = 0.7f;
webView_.layer.shadowOffset = CGSizeMake(10.0f, 10.0f);
webView_.layer.shadowRadius = 5.0f;
webView_.layer.masksToBounds = NO;
UIBezierPath *path = [UIBezierPath bezierPathWithRect:_label.bounds];
webView_.layer.shadowPath = path.CGPath;
Anyway, the result is not as expected:

Ahemmm… the shadow did away with the rounded corners…
The trouble lies with the CALayer‘s `masksToBounds` option conflicting with the UIWebView‘s`clipsToBounds`…
What comes to the rescue is the fact that `UIWebView` is just a web-wrapper around a `UIScrollView` which is in charge of displaying the rendered content… this is where the rounding has to be done actually. So let’s try it this way:
webView_.layer.cornerRadius = 10;
for (UIView* subview in webView_.subviews)
subview.layer.cornerRadius = 10;
webView_.layer.shadowColor = [UIColor blackColor].CGColor;
webView_.layer.shadowOpacity = 0.7f;
webView_.layer.shadowOffset = CGSizeMake(10.0f, 10.0f);
webView_.layer.shadowRadius = 5.0f;
webView_.layer.masksToBounds = NO;
UIBezierPath *path = [UIBezierPath bezierPathWithRect:_label.bounds];
webView_.layer.shadowPath = path.CGPath;

Now the result is what was to be hoped…
Smoothing CCGridActions in Cocos2D for iPhone
CCGridActions are a great feature of cocos2d. They provide nice 2D and “3D” effects that you can use to make your app or game appearance more appealing. I have already written about them, mostly about the high cost the exact in terms of CPU time (and FPS), what makes them barely usable in a real, sufficiently complex scenario. In a recent post of mine, I described a solution to this issue, which though not a full replacement for “real” grid actions, makes them usable, fast, and not at all demanding in terms of processing power.
Boundary value analysis for bug fixing
Anyone who has worked in quality assurance or is serious about testing knows about a technique used to define test cases that is called boundary value analysis. Here is how Wikipedia describes it:
cocos2d and the new retina iPad - take 2
I described in a previous post about cocos2d and the new retina iPad a quick solution to the problem of supporting higher-resolution images. The main objective of that work was to make easier re-building your app for submission on the App Store before you could possibly provide higher-resolution images for the new iPad. I mentioned anyway that that approach was just a quick hack and not a full answer to the need to provide 4 (four!) different versions for any of your artworks.
