How to resize UIView manually/programmatically whi

2019-08-05 05:36发布

问题:

In my map application the MapView controller is opens well in phone call mode. When I open detailView which is another UIView(subview) in same controller it does not get resize in phone call mode. I have followed Iphone- How to resize view when call status bar is toggled? the link also try to autosize my UIView but still the problem exist. My detailView is going out(down) of screen. Is there any other solution or I am missing something in code?? plz suggest..

Edit Actually my firstView controller contains mapview and tableview on segment button. And detailview which opens on annotation callout as UIView on same screen. My detailview contain 4 buttons with 4 labels and top and bottom bar. The the half of bottom bar get hide in phone call mode..

     //BusinessCard(detailview) content
     ShowroomName.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //label
    Address_Bcard.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //label
    p_Bcard.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //button
    e_Bcard.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //button
    w_Bcard.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //button
    aButton.autoresizingMask =  UIViewAutoresizingFlexibleBottomMargin; //button

    ViewOnMapButton.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;  //button on bottom bar

回答1:

Try using

ViewOnMapButton.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;

Also for specific label position you need to check and update accordingly.