Questions tagged [viewdidlayoutsubviews]

52 questions
0
votes
1 answer

StackView returns the ex-height in viewDidLayoutSubviews

So I have a scrollView, inside that scrollView is a stackView that contains every views in the screen. The problem is my stackView has many hide-able views so I need to adjust my containsVieww's height base on my stackView's height my psuedo code…
bao le
  • 927
  • 2
  • 7
  • 12
0
votes
0 answers

viewDidLayoutSubviews & UIApplicationDidBecomeActive notification

In my viewDidLoad, I add code to follow UIApplication.didBecomeActive notification as follows: NotificationCenter.default.addObserver(self, selector: #selector(ViewController.applicationDidBecomeActive), …
0
votes
2 answers

De activate constraints between 2 objects linking them together

My swift code as you can see in the gif below. Lets the user select one of the image views then use the slider to increase or decrease the size of that image view. The problem is when the image view is moved the other image view follows it that…
0
votes
1 answer

iOS get the subviews bounds when rotation happened

Once rotated the phone, how can I get subview's final bounds? As said, I rewrite the viewDidLayoutSubview method but only get the self.view's final bounds, the subview are using auto layout to positioning. So is there a way to get the subviews final…
Jin
  • 53
  • 5
0
votes
1 answer

moving app to background, calls viewDidLayoutSubView and create a lot of warnings with UICollectionView

it's all start from a lot of warnings about the width of collectionView cells, That was written to console every time I press home button. I thought it's something with size of the cells and tried to fix it. Only after some testing, I notice that…
user1105951
  • 2,259
  • 2
  • 34
  • 55
0
votes
0 answers

viewDidLayoutSubviews getting called twice and convertPoint improperly converting on first render

I am trying to animate UITabBar items by using a UIImageView and setting its frame in the same frame as my UITabBarItem's when the view first renders to the user. In a different project, it works fine on viewDidAppear, logs showing that the frame is…
0
votes
1 answer

Why doesn't code in (isMovingToParentViewController) run in viewDidLayoutSubviews()

I have a viewController, I'm using anchors and I want to get the frame of a button. I only want the frame when the view is pushed on so I use isMovingToParentViewController. Like this: if isMovingToParentViewController { let myButtonFrame =…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
0
votes
2 answers

I want to change bottom layer of text field color when i start typing to blue

func designTextField() { //Set the horizontal line in bottom of text field nameLayer.frame = CGRect(x: 0, y: self.tfName.bounds.size.height-1, width: self.tfName.bounds.size.width, height: 1) nameLayer.backgroundColor =…
Rahul Chopra
  • 71
  • 1
  • 8
0
votes
1 answer

How do I efficiently manage screen size changes and redrawing with storyboards, initWithCoder, viewDidLoad and viewDidLayoutSubviews?

I am using storyboard layouts to set up view layout. I am supporting both iPhone and iPad layouts. When the view is created with initWithCoder:, it is initially created with the frame size of the device I was last looking at in Interface Builder. If…
0
votes
1 answer

UI Code in viewDidLayoutSubViews doesn't render correctly at runtime

I have recently been battling with my view controller to set the correct dimensions of a border on a UIView. *edit, this is for a static tableview (i am using it as a form). I am aware of rounding cells in a .xib and reusing the cell however I am…
0
votes
3 answers

getting highly confused by odd behaviour of viewController Method

I have overrided a method as override func viewDidLayoutSubviews() { // creating bottom line for textField let border = CALayer() let width = CGFloat(1.0) border.borderColor = UIColor.whiteColor().CGColor …
Umair Afzal
  • 4,947
  • 5
  • 25
  • 50
0
votes
1 answer

Override the Autolayout center values of UIButton in a Subview @ viewDidLayoutSubviews

I use Autolayout for a fairly complex Menu and really need it. All Buttons, UIViews etc. of my Menu are in a separate UIView called "menuSubview". If the user presses a button the whole "menuSubview" shifts to another position to reveal other parts…
0
votes
1 answer

PFLoginViewController infinite loop from viewDidLayoutSubviews?

Has anyone run into an issue in iOS 9 with PFLoginViewController (from the ParseUI framework)? In iOS 8, per the Parse documentation, I set up the custom fields to the LoginViewController in viewDidLayoutSubviews, however, in iOS 9, it enters into…
rswayz
  • 1,122
  • 2
  • 10
  • 21
0
votes
2 answers

iOS:TableView Not Scrolling Smoothly due to Setting Constraints at Runtime in CellForRowAtIndexPath

I am Using StoryBoard and Using Autolayout , I have set Constraints at runtime for Custom cell.Also I have set constraints in ViewDidLayoutSubviews to Handle Device Orientation. So This is taking time for Cell to configure and my cell is not…
0
votes
1 answer

When set new frame of tableview in viewDidLayoutSubviews app crashes in iOS 7

- (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; if (employeeListModel.count > 0) { if ([employeeListModel count]*90 < self.view.bounds.size.height-64) { CGRect frame = self.empListTableView.frame; …
Bhuvan Bhatt
  • 3,276
  • 2
  • 18
  • 23