【发布时间】:2010-11-02 01:45:32
【问题描述】:
我有一个 UIView 子类,我希望它是 50x50;当我加载它时,它总是占据整个屏幕我该如何解决这个问题?
【问题讨论】:
我有一个 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)];
【讨论】: