I want to show some information annotated on a map and below the map I want to show a very simple custom date picker.
I created a custom view in a nib and associated it with an instance of UIView.
This same class contains this function to load the view instance from a nib.
+(id)loadCustomDatePicker
{
CustomDatePicker *customDatePicker = [[[NSBundle mainBundle] loadNibNamed:@"CustomDatePicker" owner:nil options:nil] lastObject];
if ([customDatePicker isKindOfClass:[CustomDatePicker class]])
return customDatePicker;
else
return nil;
}
Here is my screenshot from interface builder.
In my view controller's viewDidAppear method, I am using this code to load the custom view
CustomDatePicker *customDatePicker = [CustomDatePicker loadCustomDatePicker];
[self.view addSubview:customDatePicker];
[self.view bringSubviewToFront:customDatePicker];
customDatePicker.frame = CGRectMake(0, 375, 320, 40);
Here is the simulation screenshot:
Dimensions of the custom view have been set to 320 x 40 in the nib file. Background is transparent.
HERE IS THE PROBLEM:
Since height of the scene is 504, my code should have been
customDatePicker.frame = CGRectMake(0, 464, 320, 40);
But when I implement this I can only see the map. Even (0,400), (0,420) does not work. I used trial and error and used (0,375).
Visually my objective seems to be complete. But I dont know why (0,375) is working when it is not supposed to work.