Last active
          August 29, 2015 14:24 
        
      - 
      
- 
        Save hanshsieh/b97dd950ce2b7441187b to your computer and use it in GitHub Desktop. 
    Fix the problem that status bar overlaps the view
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @implementation MyViewController | |
| - (void)viewWillAppear:(BOOL)animated { | |
| if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { | |
| CGRect viewBounds = [self.view bounds]; | |
| viewBounds.origin.y = 18; | |
| viewBounds.size.height = viewBounds.size.height - 18; | |
| self.view.frame = viewBounds; | |
| } | |
| // Some other code... | |
| [super viewWillAppear:animated]; | |
| } | |
| @end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment