objective c - Wrong height when adding autolayout subview in iOS app -


I am trying to add a subview to an existing view. I am basically adding a subview to copy ActionSheet like this example:

This example works fine until I do autollection on custom ActionSheet. When I encounter some problems, I am adding a subview to a red scene, its height in this red scene, and the obstacles to the horizontal and vertical position.

xib

My problem is that the height does not seem to be 4S And the right footage on 5S devices becomes taller than 4S to 5S. I expected that it would be the second way because 5S has more than 4Ss I

 from the edge

I add the subview with this code:

[self. View addSubview: self.customActionSheet.view]; [Self.customActionSheet viewWillAppear: NO];

If I add a view by pressing it instead:

[self.navigationController pushViewController: self.customActionSheet Animated: Yes];

Then, as a result, I expected the 4S was completely covered by the red view and in the 5s still there is some area above the red scene.

What am I doing wrong here?

Size does not change according to auto view Device screen [UINavigationController pushViewController: animated] will work because the navigation controller is the frame of view for you, the quick way to set the frame of your footage with the current view.

  self.customActionSheet.view.frame = self.view.bounds; Do not see   

and : automatically, the system will implement it.

My suggestion uses automatic layouts to complete your view for supervision. The following code uses PureLayout:

  [self.view addSubview: self.customActionSheet.view] [self.customActionSheet.view autoPinEdgesToSuperviewEdgesWithInsets: UIEdgeInsetsZero];    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -