Objective c 如果以编程方式创建ViewController,我们如何利用自动调整的插入?

Objective c 如果以编程方式创建ViewController,我们如何利用自动调整的插入?,objective-c,xcode4.5,Objective C,Xcode4.5,在IOS 7中,苹果会自动调整viewController的插入 如果我们在XIB中指定viewController,这是可行的 如果我们以编程方式创建viewController呢 我们如何指定scrollView是我们希望调整插图的视图 事实上,我们如何自我调整插图 代码如下: - (void)viewDidLoad { [super viewDidLoad]; UICollectionView * cv = (UICollectionView *)self.view;

在IOS 7中,苹果会自动调整viewController的插入

如果我们在XIB中指定viewController,这是可行的

如果我们以编程方式创建viewController呢

我们如何指定scrollView是我们希望调整插图的视图

事实上,我们如何自我调整插图

代码如下:

- (void)viewDidLoad
{ 
    [super viewDidLoad];

    UICollectionView * cv = (UICollectionView *)self.view; //The collection view is self.view
    cv.backgroundColor = [UIColor clBackGroundColor];
    [cv registerClass:[BGCollectionViewCellImage class] forCellWithReuseIdentifier:[BGCollectionViewCellImage reuseIdentifier]];
    BOOL autoInset = self.automaticallyAdjustsScrollViewInsets;//auto inset is yes
    while(false);
    // Do any additional setup after loading the view.
}
事实上,我想知道如果scrollVIew是self.view,并且self.automaticallyAdjustScrollViewInsets显然是YES,那么automaticallyAdjustScrollViewInsets在这一点上怎么不起作用