我有一个 UIView 子类,我希望它是 50x50;当我加载它时,它总是占据整个屏幕我该如何解决这个问题?
最佳答案
发布一些代码可以帮助我们帮助您,但这里是您如何设置任何 UIView 子类的框架:
// When creating the view...
UIView *yourView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
// or after having created the view...
yourView.frame = CGRectMake(0, 0, 50, 50);
// ... or
[yourView setFrame:CGRectMake(0, 0, 50, 50)];
关于ipad - 如何以编程方式使 UIView subview 固定大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4074378/