/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
WB_screen_menuImage.h file: 1) Between the curly braces, add: UIView *backgroundView; 2) In the "properties" section, add: @property (nonatomic, retain) UIView *backgroundView; WB_screen_menuImage.m file: 3) In the viewDidLoad method, near the top add: //init background view backgroundView = [UIView new]; backgroundView.frame = self.view.frame; 4) In the viewDidLoad section, look for all the "addSubview" methods and replace like so: old: [self.view addSubview:headerImage]; new: [backgroundView addSubview:headerImage]; old: [self.view addSubview:myTableView]; new: [backgroundView addSubview:myTableView]; 5) In the viewDidLoad section, near the bottom add: //add background view [self.view addSubview:backgroundView]; 6) In the viewWillAppear section, find the "//setup navigation bar and background" code and add the following below it: //setup navigation bar and background [BT_viewUtilities configureBackgroundAndNavBar:self theScreenData:[self screenData]]; //set backgroundView image/color NSString *bgColor = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundColor" defaultValue:@"clear"]; NSString *bgImage = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundImageNameSmallDevice" defaultValue:@""]; if ([appDelegate.rootApp.rootDevice isIPad]) { bgImage = [BT_strings getJsonPropertyValue:screenData.jsonVars nameOfProperty:@"backgroundImageNameLargeDevice" defaultValue:@""]; } if ([bgColor length]>0) { UIColor *bgColorObj = [BT_color getColorFromHexString:bgColor]; backgroundView.backgroundColor = bgColorObj; } if ([bgImage length]>0) { UIImageView *bgImageView = [UIImageView new]; bgImageView.frame = backgroundView.frame; [bgImageView setContentMode:UIViewContentModeScaleToFill]; if ([BT_fileManager doesFileExistInBundle:bgImage]) { bgImageView.image = [UIImage imageNamed:bgImage]; } else if ([BT_fileManager doesLocalFileExist:bgImage]) { bgImageView.image = [BT_fileManager getImageFromFile:bgImage]; } [backgroundView addSubview:bgImageView]; [backgroundView sendSubviewToBack:bgImageView]; }