<UI>UIView的autoresizingMask属性
UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5
UIViewAutoresizingNone:控件相对于父视图坐标值不变;
UIViewAutoresizingFlexibleWidth:控件的宽度随着父视图的宽度按比例改变;
例如:label宽度为100,屏幕的宽度为320。当屏幕宽度为480时,label宽度变为100*480/320
UIViewAutoresizingFlexibleHeight:与UIViewAutoresizingFlexibleWidth相同
UIViewAutoresizingFlexibleLeftMargin:到屏幕左边的距离随着父视图的宽度按比例改变;
例如:CGRectMake(50, 100, 200, 40)]; 当屏幕的宽度为320,x为50;当屏幕宽度为480时,labelx坐标变为 50*480/320。控件坐标变为 CGRectMake(75, 100, 200, 40)];
UIViewAutoresizingFlexibleRightMargin、UIViewAutoresizingFlexibleTopMargin、UIViewAutoresizingFlexibleBottomMargin与UIViewAutoresizingFlexibleLeftMargin类似
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步