How do I apply a perspective transform to a UIView?

As Ben said, you’ll need to work with the UIView’s layer, using a CATransform3D to perform the layer’s rotation. The trick to get perspective working, as described here, is to directly access one of the matrix cells of the CATransform3D (m34). Matrix math has never been my thing, so I can’t explain exactly why this … Read more

How to use UIVisualEffectView to Blur Image?

Just put this blur view on the imageView. Here is an example in Objective-C: UIVisualEffect *blurEffect; blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; UIVisualEffectView *visualEffectView; visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; visualEffectView.frame = imageView.bounds; [imageView addSubview:visualEffectView]; and Swift: var visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) visualEffectView.frame = imageView.bounds imageView.addSubview(visualEffectView)

Autoresizing masks programmatically vs Interface Builder / xib / nib

Yes, you have cited things correctly. Also, I agree that it feels a bit backwards, so for that reason I appreciate your post. You might like using a preprocessor Macro UIViewAutoresizingFlexibleMargins when making a UIView’s margin flexible in every direction. I put this in the precompiled header file so it gets included everywhere. #define UIViewAutoresizingFlexibleMargins … Read more

iPhone – Get Position of UIView within entire UIWindow

That’s an easy one: [aView convertPoint:localPosition toView:nil]; … converts a point in local coordinate space to window coordinates. You can use this method to calculate a view’s origin in window space like this: [aView.superview convertPoint:aView.frame.origin toView:nil]; 2014 Edit: Looking at the popularity of Matt__C’s comment it seems reasonable to point out that the coordinates… don’t … Read more

UIView Infinite 360 degree rotation animation?

Found a method (I modified it a bit) that worked perfectly for me: iphone UIImageView rotation #import <QuartzCore/QuartzCore.h> – (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat { CABasicAnimation* rotationAnimation; rotationAnimation = [CABasicAnimation animationWithKeyPath:@”transform.rotation.z”]; rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ]; rotationAnimation.duration = duration; rotationAnimation.cumulative = YES; rotationAnimation.repeatCount = repeat … Read more

How to set iPhone UIView z index?

You can use the zPosition property of the view’s layer (it’s a CALayer object) to change the z-index of the view. theView.layer.zPosition = 1; As Viktor Nordling added, “big values are on top. You can use any values you want, including negative values.” The default value is 0. You need to import the QuartzCore framework … Read more

How to find topmost view controller on iOS

I think you need a combination of the accepted answer and @fishstix’s + (UIViewController*) topMostController { UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController; while (topController.presentedViewController) { topController = topController.presentedViewController; } return topController; } Swift 3.0+ func topMostController() -> UIViewController? { guard let window = UIApplication.shared.keyWindow, let rootViewController = window.rootViewController else { return nil } var topController = … Read more

How to add a touch event to a UIView?

In iOS 3.2 and higher, you can use gesture recognizers. For example, this is how you would handle a tap event: //The setup code (in viewDidLoad in your view controller) UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; [self.view addGestureRecognizer:singleFingerTap]; //The event handling method – (void)handleSingleTap:(UITapGestureRecognizer *)recognizer { CGPoint location = [recognizer locationInView:[recognizer.view superview]]; //Do stuff … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)