我今天花了几个小时的时间来隐藏我的应用程序时的PickerView,但问题不是PickerView。是和CGRectMake一起的。
我在Xcode上尝试了一个简单的项目,只是为了告诉你CGRectMake不适合我.
下面是我的故事板(灰色区域是UIView组件):

这是我的界面:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *container;
@end这是我的实现文件:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_container.frame = CGRectMake(0, 0, 320, 204);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end这是非常基本的代码,不受其他代码的污染.但是,任何给出的CGRectMake的数字都不能使这个灰色地带移动。我改变了X,Y值,但是灰色的UIView就像你在故事板上看到的一样。
为什么CGRectMake不处理我的案子?问题出在哪里?
更新:我在我的检验员框中看到了自动收费表。

更新:这是我的连接检查器

发布于 2013-09-17 13:19:44
如果为AutoLayout启用了Storyboard,那么更改视图的frame就无法工作。
不能直接使用AutoLayout更改框架。你必须改变他们周围的限制。
如果您禁用AutoLayout的Storyboard,它将工作。
发布于 2013-09-17 13:15:14
确保您的
IBOUTLET连接与视图连接。
发布于 2013-09-17 13:24:52
CGrectmake之所以可以工作,只是因为您将帧大小设置为CGRectMake(0、0、320、204);按照大小,如果您想将x或y坐标隐藏为超出绑定值,则自定义视图将在主视图中可见。那就别忘了取消自动收费表
container.frame = CGRectMake(200, 0, 320, 204);https://stackoverflow.com/questions/18850871
复制相似问题