CSS3 transform on click using pure CSS

If you want a css only solution you can use active .crossRotate:active { transform: rotate(45deg); -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); } But the transformation will not persist when the activity moves. For that you need javascript (jquery click and css is the cleanest IMO). $( “.crossRotate” ).click(function() { if ( $( this ).css( “transform” ) == … Read more

iOS 8 Rotation Methods Deprecation – Backwards Compatibility

I just had this issue and I wanted to use the same methods that I was using before (at least for now), so this is what I did. – (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; //The device has already rotated, that’s why this method is being called. UIInterfaceOrientation toOrientation = [[UIDevice currentDevice] orientation]; //fixes orientation … Read more

Getting the correct bounds of UIViewController’s view

How to do this correctly Your UIViewController subclass should override the method viewWillLayoutSubviews, see also here. When this method is called, the viewController’s view has its correct size and you can make any necessary adjustments to subviews prior to the layout pass over the subviews. Swift override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() NSLog(“bounds = \(self.view.bounds)”) } … Read more

Get element -moz-transform:rotate value in jQuery

Here’s my solution using jQuery. This returns a numerical value corresponding to the rotation applied to any HTML element. function getRotationDegrees(obj) { var matrix = obj.css(“-webkit-transform”) || obj.css(“-moz-transform”) || obj.css(“-ms-transform”) || obj.css(“-o-transform”) || obj.css(“transform”); if(matrix !== ‘none’) { var values = matrix.split(‘(‘)[1].split(‘)’)[0].split(‘,’); var a = values[0]; var b = values[1]; var angle = Math.round(Math.atan2(b, a) … Read more

how to create iphone’s wobbling icon effect?

Simple way to do it: #define RADIANS(degrees) (((degrees) * M_PI) / 180.0) CGAffineTransform leftWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(-5.0)); CGAffineTransform rightWobble = CGAffineTransformRotate(CGAffineTransformIdentity, RADIANS(5.0)); itemView.transform = leftWobble; // starting point [UIView beginAnimations:@”wobble” context:itemView]; [UIView setAnimationRepeatAutoreverses:YES]; // important [UIView setAnimationRepeatCount:10]; [UIView setAnimationDuration:0.25]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(wobbleEnded:finished:context:)]; itemView.transform = rightWobble; // end here & auto-reverse [UIView commitAnimations]; … – … Read more

Rotate ImageView source from layout xml file

You can use Available Since API Level 11 android:rotation=”90″ Final Code to Put, <ImageView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:rotation=”90″ android:contentDescription=”@string/image_divider” android:paddingBottom=”8dp” android:paddingTop=”4dp” android:scaleType=”fitXY” android:src=”https://stackoverflow.com/questions/11243314/@android:drawable/divider_horizontal_textfield” />