I am developing an iOS app in which it is required to change the height of UITabBar
. First, I changed it via the frame property of tabbar
but that didn't give desired results and icon sizes were also very small. So, I wrote the following code to change the background of the tabbar
and to increase the size of its icons.
for (UIView *view in ctrl.tabBar.subviews) {
if ([NSStringFromClass(view.class) isEqualToString:@"_UITabBarBackgroundView"]) {
[view removeFromSuperview];
CGRect frame = ctrl.tabBar.frame;
frame.origin = CGPointZero;
frame.size.height = floor(frame.size.height / 2);
UIView *background = [[UIView alloc] initWithFrame:frame];
background.backgroundColor = [UIColor colorWithRed:0.15 green:0.15 blue:0.15 alpha:1.0];
background.userInteractionEnabled = NO;
[ctrl.tabBar addSubview:background];
[ctrl.tabBar sendSubviewToBack:background];
[background release];
}
for (UIView *subview in view.subviews) {
if ([NSStringFromClass(subview.class) isEqualToString:@"UITabBarSwappableImageView"]) {
CGRect frame = subview.frame;
frame.size.height = 80;
subview.frame = frame;
subview.contentMode = UIViewContentModeCenter;
}
if ([NSStringFromClass(subview.class) isEqualToString:@"UITabBarButtonLabel"]) {
CGRect sFrame = subview.frame;
sFrame.size.height += diff;
subview.frame = sFrame;
}
}
}
So I want to confirm, "Is this code safe for approval or not?"
You don't have to worry about being rejected for using a private API, because you aren't using one. Many apps are on the store now with custom tab bars, so it shouldn't be a problem on that basis either. By styling the tab bar certain ways, though, you may not be adhering to the iOS Human Interface Guidelines. According to the App Store Review Guidelines, especially section 10 on this page, not following interface guidelines is grounds for rejection. I recommend reading the guidelines for more information; they have a lot of good advice anyway.
Apple seems to be a lot faster about responding to submissions now than they used to be, so since it looks like you already have everything set up, you could send it in and see what they say. I don't foresee a major problem, but Apple has the final word. They often will tell you exactly what's wrong so you can correct it easily.