I want to create a UIView
which will resize it's width according to iPhone Screen size and it should be remain at bottom of view.
I created fresh project with storyboard and add below code.
Here is my code
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:true];
UIView *box = [[UIView alloc]initWithFrame:CGRectMake(0, 448, 320, 120)];
[box setBackgroundColor:[UIColor redColor]];
[box setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
[box setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[box setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
[box setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
[box setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin];
[self.view addSubview:box];
}
Auto layout is OFF.
If I do same thing by apply autoresizing from interface builder then it's working perfectly.
I didn't understand any reason for why it's not working.