Here comes from Apple's View and Window Architecture documentation:
In addition to providing its own content, a view can act as a container for other views. When one view contains another, a parent-child relationship is created between the two views. The child view in the relationship is known as the subview and the parent view is known as the superview. The creation of this type of relationship has implications for both the visual appearance of your application and the application’s behavior.
So when you set dimView.alpha = 0.4;
(which is your super view) it automatically changes the opacity of it's sub views too. Because your super view holds those sub views and underlying layers which drawn by Core Animation.
If you want to change opacity of your super view only, you can do this via:
[dimView setBackgroundColor:[UIColor colorWithWhite:0 alpha:0.5]];
See also: