关闭AutoLayOut,使用手动布局

-(void)addButton

{

    CGRect frame;

    frame.origin.y = self.topLayoutGuide.length+20;

    frame.size.height = 40;

    frame.size.width = (self.view.bounds.size.width - 20*2-10)/2;

    frame.origin.x = 20;

    self.btn1.frame = frame;

    frame.origin.x = 20+10+frame.size.width;

    self.btn2.frame = frame;


}

-(void)addUIImageView

{

    CGRect frame;

    frame.origin.x = 20;

    frame.origin.y = 70+self.topLayoutGuide.length;

    frame.size.height = self.view.bounds.size.height -self.topLayoutGuide.length- 70 -50;

    frame.size.width = self.view.bounds.size.width - 20*2;

    self.imageView.frame = frame;

    self.imageView.image = [UIImage imageNamed:@"6_full.JPG"];

}

-(void)viewDidLayoutSubviews

{

    [super viewDidLayoutSubviews];

    [self addButton];

    [self addUIImageView];

}


你可能感兴趣的:(IOS)