Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RagingGoat

macrumors 6502
Original poster
Jun 21, 2010
308
15
I have a UIToolBar that is showing up correctly on iPhone 4S, 5, and 5S, but doesn't show at all on iPhone 6 and 6 Plus.
Code:
UIToolbar *webToolBar = [[UIToolbar alloc]init];
    
CGSize result = [[UIScreen mainScreen] bounds].size;
NSInteger y = [[UIScreen mainScreen]bounds].size.height - 44;
NSInteger screenWidth = [[UIScreen mainScreen]bounds].size.width;
        
NSLog(@"Screen height = %f", [[UIScreen mainScreen]bounds].size.height);
NSLog(@"y = %ld and width = %ld", (long)y, (long)screenWidth);
        
fixedSpace.width = 20.0;
        
// webToolBar.frame = CGRectMake(0, y, screenWidth, 44);
        
[webToolBar setItems:[NSArray arrayWithObjects:backButton, forwardButton, flexibleSpace, refreshButton, fixedSpace, stopButton, nil]animated:NO];
        
if (result.height == 480) {
    webToolBar.frame = CGRectMake(0, 372, 320, 44);
}
else if (result.height == 568) {
     webToolBar.frame = CGRectMake(0, 460, 320, 44);
}
else if (result.height == 667) {
     webToolBar.frame = CGRectMake(0, 623, 375, 44);
}
else if (result.height == 736) {
     webToolBar.frame = CGRectMake(0, 692, 414, 44);
}

webToolBar.delegate = self;
    [webToolBar setBarStyle:UIBarStyleDefault];
    webToolBar.tintColor = kfbBlue;
    webToolBar.hidden = NO;
    [webToolBar sizeToFit];
    [self.view addSubview:webToolBar];

I've also tried doing it this way but it doesn't show up on any devices with this.

Code:
UIToolbar *webToolBar = [[UIToolbar alloc]init];

        CGSize result = [[UIScreen mainScreen] bounds].size;
        NSInteger y = [[UIScreen mainScreen]bounds].size.height - 44;
        NSInteger screenWidth = [[UIScreen mainScreen]bounds].size.width;
        
        NSLog(@"Screen height = %f", [[UIScreen mainScreen]bounds].size.height);
        NSLog(@"y = %ld and width = %ld", (long)y, (long)screenWidth);
        
        fixedSpace.width = 20.0;
        
        webToolBar.frame = CGRectMake(0, y, screenWidth, 44);
        
        [webToolBar setItems:[NSArray arrayWithObjects:backButton, forwardButton, flexibleSpace, refreshButton, fixedSpace, stopButton, nil]animated:NO];

webToolBar.delegate = self;
    [webToolBar setBarStyle:UIBarStyleDefault];
    webToolBar.tintColor = kfbBlue;
    webToolBar.hidden = NO;
    [webToolBar sizeToFit];
    [self.view addSubview:webToolBar];
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.