CGRectMake is not working with UIView

前端 未结 3 1982
不知归路
不知归路 2020-12-07 05:56

I spent hours of my day today just to hide PickerView when my app is loaded, but the problem is not with the PickerView. it\'s with CGRectMake.

I tried a simple proj

相关标签:
3条回答
  • 2020-12-07 06:22

    Make sure that your IBOUTLET connection is joined with the view.

    0 讨论(0)
  • 2020-12-07 06:38

    If you have AutoLayout enabled for the Storyboard then changing the frame of a view won't work.

    You can't change frames directly using AutoLayout. You have to change the constraints around them.

    If you disable AutoLayout for the Storyboard it will work.

    0 讨论(0)
  • 2020-12-07 06:39

    CGrectmake working only because you set frame size as CGRectMake(0, 0, 320, 204); as per the size the custom view will be visible inside the main view if you want to hide change x or y co-ordinates to out of bound value like this. Then don forget to uncheck autolayout

    container.frame = CGRectMake(200, 0, 320, 204);
    
    0 讨论(0)
提交回复
热议问题