Skip to content

Commit

Permalink
-fixed bug where colors wouldn't load on a fresh device
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCrabbe committed Jun 13, 2014
1 parent c7841ab commit 7ed6493
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -915,14 +915,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer: Matthew Hudnall (Y3BWVQJ2DH)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Matthew Hudnall (Y3BWVQJ2DH)";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "UniversityPrograms/UniversityPrograms-Prefix.pch";
INFOPLIST_FILE = "UniversityPrograms/UniversityPrograms-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "928EC205-E2A8-419B-853E-E3A6A02EC38F";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand Down
7 changes: 6 additions & 1 deletion UniversityPrograms/UniversityPrograms/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

if(![[NSUserDefaults standardUserDefaults] boolForKey:@"firstLoad"]){
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstLoad"];
[UIColor setThemeColor:[UIColor grassColor]];
[[NSUserDefaults standardUserDefaults] synchronize];
}
//create the tab bar and set it to be the main view controller
[UIColor setThemeColor:[UIColor getThemeColor]];

Expand All @@ -47,6 +51,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.baseTabBarController = [[UPTabbarViewController alloc]init];
self.baseTabBarController.tabBar.translucent = NO;


_baseTabBarController.tabBar.tintColor = [UIColor getThemeColor];
if([[NSUserDefaults standardUserDefaults]boolForKey:@"darkMode"]){
self.baseTabBarController.tabBar.barStyle = UIBarStyleBlackOpaque;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Ugh-SD-ZQ3">
<rect key="frame" x="20" y="40" width="300" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.2470588235" green="0.2470588235" blue="0.2470588235" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
Expand Down
13 changes: 10 additions & 3 deletions UniversityPrograms/UniversityPrograms/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,29 @@ -(void)changedColorScheme:(UIColor *)color {
self.darkModeToggle.onTintColor = [UIColor UPCrimsonColor];
[UIColor setThemeColor:[UIColor UPCrimsonColor]];
[self updateColors:[UIColor getThemeColor]];
[self.colorPickerView removeFromSuperview];
[[NSUserDefaults standardUserDefaults] setInteger:self.colorSelector.selectedSegmentIndex forKey:@"colorSelection"];
}
else if(self.colorSelector.selectedSegmentIndex==1){
self.colorSelector.tintColor = [UIColor grassColor];
self.darkModeToggle.onTintColor = [UIColor grassColor];
[UIColor setThemeColor:[UIColor grassColor]];
[self updateColors:[UIColor getThemeColor]];
[self.colorPickerView removeFromSuperview];
[[NSUserDefaults standardUserDefaults] setInteger:self.colorSelector.selectedSegmentIndex forKey:@"colorSelection"];
}
else if(self.colorSelector.selectedSegmentIndex==2){
self.colorSelector.tintColor = [UIColor tealColor];
self.darkModeToggle.onTintColor = [UIColor tealColor];
[UIColor setThemeColor:[UIColor tealColor]];
[self updateColors:[UIColor getThemeColor]];
[self.colorPickerView removeFromSuperview];
[[NSUserDefaults standardUserDefaults] setInteger:self.colorSelector.selectedSegmentIndex forKey:@"colorSelection"];

}
else{


[[NSUserDefaults standardUserDefaults] setInteger:self.colorSelector.selectedSegmentIndex forKey:@"colorSelection"];
self.colorSelector.tintColor = [UIColor getThemeColor];
self.darkModeToggle.onTintColor = [UIColor getThemeColor];
if(!self.colorPickerView){
Expand All @@ -115,11 +121,12 @@ -(void)changedColorScheme:(UIColor *)color {

}];

[self.view addSubview:self.colorPickerView];

}
[self.view addSubview:self.colorPickerView];
self.colorPickerView.color=[UIColor getThemeColor];
}

[[NSUserDefaults standardUserDefaults] synchronize];

//[UITabBar appearance].tintColor=[UIColor getThemeColor];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<segmentedControl opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="1" translatesAutoresizingMaskIntoConstraints="NO" id="FIv-3c-QjY">
<rect key="frame" x="20" y="68" width="280" height="29"/>
<rect key="frame" x="20" y="116" width="280" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<segments>
<segment title="Crimson"/>
Expand All @@ -33,22 +33,22 @@
</connections>
</segmentedControl>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="gFd-Qc-AMF">
<rect key="frame" x="80" y="113" width="51" height="31"/>
<rect key="frame" x="251" y="37" width="51" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
<action selector="toggledDarkMode:" destination="-1" eventType="valueChanged" id="67Q-sJ-mI7"/>
</connections>
</switch>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Dark Mode" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4CW-Gm-4Zi">
<rect key="frame" x="137" y="113" width="130" height="31"/>
<rect key="frame" x="20" y="37" width="130" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="22"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Color Scheme" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hxG-MR-aIA">
<rect key="frame" x="20" y="28" width="280" height="32"/>
<rect key="frame" x="20" y="76" width="280" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="22"/>
Expand Down

0 comments on commit 7ed6493

Please sign in to comment.