I have a custom view in a tab bar view controller. I have set the autoresize mask for the custom view but it is not getting aligned on the iphone 5 screen. It looks fine on the iphone 4 screen. I have this code in the view did load method of the tab bar view controller.
self.customBadge = [CustomBadge customBadgeWithString:[AppGlobals sharedInstance].badgeNumber];
self.customBadge.frame = CGRectMake(165, 420, self.customBadge.frame.size.width, self.customBadge.frame.size.width);
self.customBadge.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
[self.view addSubview: self.customBadge];
It seems that you are adding your badge with coordinates according to the whole view of the TabBar (Most screen)
Try:
Adding the badge as a subview of the tabbar view itself (You may want to lower the frame’s Y from 420 to about 5-10):
[self.tabBar addSubview:self.customBadge];If (1) is not working for you, you may try a hard coded y value (this is bad practice, but if you’re stuck – it should work):
#define VALUE_BY_SCREEN_HEIGHT(regular, longScreen) (([[UIScreen mainScreen] bounds].size.height <= 480.0) ? regular : longScreen)…
self.customBadge.frame = CGRectMake(165, VALUE_BY_SCREEN_HEIGHT(420,508), self.customBadge.frame.size.width, self.customBadge.frame.size.width);