相关疑难解决方法(0)

CGRectMake不与UIView合作

今天我花了几天时间只是为了在我的应用程序加载时隐藏PickerView,但问题不在于PickerView.它与CGRectMake有关.

我在Xcode上尝试了一个简单的项目,只是为了向您展示CGRectMake对我不起作用......

这是我的故事板(灰色区域是UIView组件):

在此输入图像描述

这是我的界面:

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *container;

@end
Run Code Online (Sandbox Code Playgroud)

这是我的实施文件:

#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
Run Code Online (Sandbox Code Playgroud)

它是非常基本的代码,没有被其他代码污染......但是,给予CGRectMake的任何数字都不会使灰色区域移动.我已经改变了X,Y值,但灰色的UIView仍然像你在故事板上看到的那样.

为什么CGRectMake没有处理我的案子?哪里有问题?

更新:我在检查员框中看到了autolayout

在此输入图像描述

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

在此输入图像描述

iphone objective-c uiview ios

0
推荐指数
1
解决办法
5012
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

uiview ×1