我今天花了几个小时在我的应用程序加载时隐藏 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 不适用于我的案子?问题出在哪里?
更新:我看到在我的检查器框中检查了自动布局
更新:这是我的连接检查员