Hard iOS7 overlapping fix


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. WB_screen_menuImage.h file:
  2.  
  3. 1) Between the curly braces, add:
  4. UIView *backgroundView;
  5.  
  6. 2) In the "properties" section, add:
  7. @property (nonatomic, retain) UIView *backgroundView;
  8.  
  9. WB_screen_menuImage.m file:
  10.  
  11. 3) In the viewDidLoad method, near the top add:
  12. //init background view
  13. backgroundView = [UIView new];
  14. backgroundView.frame = self.view.frame;
  15.  
  16. 4) In the viewDidLoad section, look for all the "addSubview" methods and replace like so:
  17.  
  18. old: [self.view addSubview:headerImage];
  19. new: [backgroundView addSubview:headerImage];
  20.  
  21. old: [self.view addSubview:myTableView];
  22. new: [backgroundView addSubview:myTableView];
  23.  
  24. 5) In the viewDidLoad section, near the bottom add:
  25. //add background view
  26. [self.view addSubview:backgroundView];
  27.  
  28. 6) In the viewWillAppear section, find the "//setup navigation bar and background" code and add the following below it:
  29.  
  30. //setup navigation bar and background
  31. [BT_viewUtilities configureBackgroundAndNavBar:self theScreenData:[self screenData]];
  32.  
  33. //set backgroundView image/color
  34. NSString *bgColor = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundColor" defaultValue:@"clear"];
  35. NSString *bgImage = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundImageNameSmallDevice" defaultValue:@""];
  36. if ([appDelegate.rootApp.rootDevice isIPad]) {
  37. bgImage = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundImageNameLargeDevice" defaultValue:@""];
  38. }
  39.  
  40. if ([bgColor length]>0) {
  41. UIColor *bgColorObj = [BT_color getColorFromHexString:bgColor];
  42. backgroundView.backgroundColor = bgColorObj;
  43. }
  44. if ([bgImage length]>0) {
  45. UIImageView *bgImageView = [UIImageView new];
  46. bgImageView.frame = backgroundView.frame;
  47. [bgImageView setContentMode:UIViewContentModeScaleToFill];
  48. if ([BT_fileManager doesFileExistInBundle:bgImage]) {
  49. bgImageView.image = [UIImage imageNamed:bgImage];
  50. }
  51. else if ([BT_fileManager doesLocalFileExist:bgImage]) {
  52. bgImageView.image = [BT_fileManager getImageFromFile:bgImage];
  53. }
  54. [backgroundView addSubview:bgImageView];
  55. [backgroundView sendSubviewToBack:bgImageView];
  56. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.