ios - UIButton not respect Aspect Fill contentMode after resizing animation -
I am using the automatic layout, the initial state of the following scene
a view in the center Has a button. Fill the content mode aspect in the button, and the image is set as the background image of the button.
Then I change the view for'd use the following code, which will expand the center card to fill the screen, and the picture will be taken over the scene:
cardTrailingSpaceConstraint.constant = 0 cardLeadingSpaceConstraint. constant = 0 cardView.removeConstraint (Kardspectoraitio Kantreshn) card to Haiit consultant = Anselut contract (item: Kardwu, attribute: Kiti T, Related to: Av. Aval, Photo: View, Attribute: Heat, Multiplier: 1.0, Continuous: 0). Address Control (card-high-control) dishimagebutton.removeConstraint (dishButtonBottomSpaceConstraint) Dishboot dethantight CONNECTENT = NSLUT CONTRACTATION (item: DISH ImageButtons, attribute: .ightit, related: AQUAL, TOITAM: cardview, attribute: .IT, multiplier: 0.2, continuous: 0 ) Kardvijh.adsinstrenth (Disbutnhait Kantreshn)) CardView.setNeedsUpdateConstraints () UIView.animateWithDuration (0.7, delay: SpringWithDamping using 0,: 0.7, initialSpringVelocity: 0.7, options: zero, Animations: {[unowned self] () - & Gt; self Ard. Header = 0 self.cardView.layer.cornerRadius = 0 self.cardView.layoutIfNeeded ()}) {[Unknown themselves] (end) - & gt; Zero}} is the result:
However, this is not my wish. The button is not respecting the content.
Can anyone tell me how to fill the aspect of the aspect of the Maintenance button?
- type the button
UIButtonTypeCustom (รข ??? - button image, set the background image of the button.
- the
viewDidLoad , set button.imageView.contentMode < / Code> to UIViewContentMode.ScaleAspectFill .
Comments
Post a Comment