You can probably get away with defining the +layerClass method on a custom UIView implementation MyGradientView +(Class) layerClass { return CAGradientLayer class; } @end You can initialize the layer in your controller's viewDidLoad() (or wherever), something like (void)viewDidLoad { super viewDidLoad; (CAGradientLayer*)mMyGradientViewInstance layer setColors:nil; }.
You can probably get away with defining the +layerClass method on a custom UIView... @implementation MyGradientView +(Class) layerClass { return CAGradientLayer class; } @end You can initialize the layer in your controller's viewDidLoad() (or wherever), something like... -(void)viewDidLoad { super viewDidLoad; (CAGradientLayer*)mMyGradientViewInstance layer setColors:nil; }.
Got around to testing this, it works. – l8nite Nov 14 '10 at 7:30 1 +1 Works nicely. The layer size is managed by the parent UIView and resized automatically.
– Adolfo Feb 15 at 8:35.
(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { CGRect b; if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation))b = CGRectMake(0, 0, 480, 320); else be = CGRectMake(0, 0, 320, 480); CATransaction begin; CATransaction setValue:NSNumber numberWithFloat:duration forKey:kCATransactionAnimationDuration; self.view. Layer setBounds:b; CATransaction commit; }.
I would: Increase the size of your view to the maximum of each dimension in the willRotateToInterfaceOrientation code. (For example for an 320x480 iPhone - set the dims to 480x480). Set the bounds in accordance to the newly-rotated view in the didRotateFromInterfaceOrientation function.
This should make it so that the view is large enough so that regardless of how it is oriented during animation, it will cover the entire screen. It won't be "smooth" - because the gradient will have to be rotated, but at least you will not see behind the layer in the middle of the rotation.
I use this tequnique in mapping programs, where I have to rotate from a 320x480 to a 480x320 and want it to appear seamless. – Brad Oct 19 '10 at 16:29 Please see criteria for downvoting: stackoverflow.Com/privileges/vote-down – Brad Oct 19 '10 at 19:23 lesson learned, brad can you edit you answer,(even if its just capitalising a word) and I will take the dv off. (vote is locked unless edit) – Luke Mcneice Oct 20 '10 at 8:08 Ok - done thanx!
– Brad Oct 20 '10 at 11:42.
With the following snippet, I'm adding a drop shadow effect to one my UIView. Which works pretty well.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.