viewdidlayoutsubviews

Quick 180 rotation of iOS Device results in the camera viewing upside-down

ε祈祈猫儿з 提交于 2020-01-01 04:41:27
问题 I've implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation : - (AVCaptureVideoOrientation)interfaceOrientationToVideoOrientation:(UIInterfaceOrientation)orientation { switch (orientation) { case UIInterfaceOrientationPortrait: return AVCaptureVideoOrientationPortrait; case UIInterfaceOrientationPortraitUpsideDown: return AVCaptureVideoOrientationPortraitUpsideDown; case UIInterfaceOrientationLandscapeLeft: return

viewDidLayoutSubviews is called when label changes (xcode) (swift)

六月ゝ 毕业季﹏ 提交于 2019-12-24 17:54:58
问题 I have a label, toggle button and an animation in my code. When I press the toggle button -> animation starts , label changes. Below is my code sample. override func viewDidLayoutSubviews() { println("viewDidLayoutSubviews is called") // Initial state of my animation. } @IBAction func Toggled(sender: AnyObject) { CallTextChange() // Two different Animations } func CallTextChange() { // Change text here} Every time I change the text in label viewDidLayoutSubviews is called. Is there a way to

How do I get the correct view height in viewDidLayoutSubviews?

北慕城南 提交于 2019-12-24 03:09:14
问题 - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; NSLog(@"viewDidLayoutSubviews view.height: %f", self.view.frame.size.height); } In the above, view.height is always 1024 regardless of what orientation the device is in. Even rotating the device will cause viewDidLayoutSubviews to be called, and it will still output 1024. Yet the view renders fine. What the heck am I missing? 回答1: When iOS performs an automatic rotation, it does not change the frame property of the root view

viewDidLayoutSubviews no longer called when popping top view with UINavigationController

北战南征 提交于 2019-12-12 09:57:08
问题 iOS 10, the gift that keeps on breaking, seems to have changed another behavior. Assume two UIViewControllers are pushed onto a UINavigationController. On iOS 8/9, calling navigationController?.popViewController(animated: true) to pop the top UIViewController (say VC2) caused viewDidLayoutSubviews on the bottom view controller (say VC1) to get called. We relied on this to refresh VC1. Sometimes VC2 adds subviews to VC1 (via the data model), and this needs to get reflected when popping back to

viewDidLayoutSubviews no longer called when popping top view with UINavigationController

微笑、不失礼 提交于 2019-12-06 03:47:38
iOS 10, the gift that keeps on breaking, seems to have changed another behavior. Assume two UIViewControllers are pushed onto a UINavigationController. On iOS 8/9, calling navigationController?.popViewController(animated: true) to pop the top UIViewController (say VC2) caused viewDidLayoutSubviews on the bottom view controller (say VC1) to get called. We relied on this to refresh VC1. Sometimes VC2 adds subviews to VC1 (via the data model), and this needs to get reflected when popping back to VC1. Accurate frame information is required. We can't use viewWillAppear because frame data is wrong

Quick 180 rotation of iOS Device results in the camera viewing upside-down

扶醉桌前 提交于 2019-12-03 11:39:38
I've implemented the code below to change the orientation of an AVCaptureVideoSession based upon the UIInterfaceOrientation : - (AVCaptureVideoOrientation)interfaceOrientationToVideoOrientation:(UIInterfaceOrientation)orientation { switch (orientation) { case UIInterfaceOrientationPortrait: return AVCaptureVideoOrientationPortrait; case UIInterfaceOrientationPortraitUpsideDown: return AVCaptureVideoOrientationPortraitUpsideDown; case UIInterfaceOrientationLandscapeLeft: return AVCaptureVideoOrientationLandscapeLeft; case UIInterfaceOrientationLandscapeRight: return

UIView/CALayer: Transform triggers layoutSubviews in superview

谁说我不能喝 提交于 2019-11-28 06:48:59
When changing some of the properties for UIView it triggers layoutSubviews in the superview . I can not find any statements about this in the docs. These properties triggers layout in superview and self frame bounds These properties triggers layout in superview only transform layer.transform These properties triggers layout in self only none These properties does not trigger any layout center layer.anchorPoint layer.position alpha I find it very confusing that transform is triggering layout and that position and anchorPoint does not. Example code : https://github.com/hfossli

UIView/CALayer: Transform triggers layoutSubviews in superview

≯℡__Kan透↙ 提交于 2019-11-27 01:30:52
问题 When changing some of the properties for UIView it triggers layoutSubviews in the superview . I can not find any statements about this in the docs. These properties triggers layout in superview and self frame bounds These properties triggers layout in superview only transform layer.transform These properties triggers layout in self only none These properties does not trigger any layout center layer.anchorPoint layer.position alpha I find it very confusing that transform is triggering layout