Change ios Frame Size(width e height) keeping position (x,y)

后端 未结 3 1195
半阙折子戏
半阙折子戏 2020-12-24 05:38

How can i change Size of a Frame view and keep origin position? I tried with this code (but it didn\'t work):

myview.frame.size = CGSizeMake(23.0,50.0); 
<         


        
3条回答
  •  一整个雨季
    2020-12-24 06:25

    Here's how to do it with just one line of code:

    myview.frame = CGRectMake(23, 50, myview.frame.size.width, myview.frame.size.height);
    

    or

    [myview setFrame:CGRectMake(23, 50, myview.frame.size.width, myview.frame.size.height)];
    

提交回复
热议问题