Skip to content

Commit

Permalink
fix settings so status bar is light color on VCs where that is approp…
Browse files Browse the repository at this point in the history
…riate.
  • Loading branch information
elaewin committed Apr 27, 2017
1 parent 9ecc96a commit 04cbd29
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 41 deletions.
39 changes: 15 additions & 24 deletions CFuWx/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -39,61 +39,53 @@
<rect key="frame" x="0.0" y="28" width="375" height="166"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Mpz-mO-m1O" id="uEV-Dx-GAt">
<rect key="frame" x="0.0" y="0.0" width="375" height="165.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="166"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Time" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jX7-Lb-0ux">
<rect key="frame" x="319" y="0.0" width="40" height="22"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Bold" family="Apple SD Gothic Neo" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d5T-hO-XNq">
<rect key="frame" x="323" y="24" width="36" height="20"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Bold" family="Apple SD Gothic Neo" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e9u-lJ-p74">
<rect key="frame" x="16" y="4" width="69" height="22"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Bold" family="Apple SD Gothic Neo" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" restorationIdentifier="WeatherIcon" translatesAutoresizingMaskIntoConstraints="NO" id="vzh-eD-yFD">
<rect key="frame" x="201" y="46" width="150" height="115.5"/>
<rect key="frame" x="201" y="46" width="150" height="116"/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Summary" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GyG-Cz-Xbp">
<rect key="frame" x="16" y="119" width="169" height="26.5"/>
<rect key="frame" x="16" y="119" width="169" height="27"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Bold" family="Apple SD Gothic Neo" pointSize="22"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="120.9°F" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.75" translatesAutoresizingMaskIntoConstraints="NO" id="htT-X5-unD">
<rect key="frame" x="16" y="57.5" width="169" height="61.5"/>
<rect key="frame" x="16" y="57" width="169" height="62"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-SemiBold" family="Apple SD Gothic Neo" pointSize="51"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d5T-hO-XNq">
<rect key="frame" x="315" y="4" width="36" height="20"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Bold" family="Apple SD Gothic Neo" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="vzh-eD-yFD" secondAttribute="trailing" constant="24" id="578-xv-rah"/>
<constraint firstItem="htT-X5-unD" firstAttribute="leading" secondItem="uEV-Dx-GAt" secondAttribute="leading" constant="16" id="Dff-18-w34"/>
<constraint firstItem="vzh-eD-yFD" firstAttribute="top" secondItem="d5T-hO-XNq" secondAttribute="bottom" constant="22" id="Dnh-gC-dP4"/>
<constraint firstItem="e9u-lJ-p74" firstAttribute="leading" secondItem="uEV-Dx-GAt" secondAttribute="leading" constant="16" id="EnB-oF-Q93"/>
<constraint firstItem="jX7-Lb-0ux" firstAttribute="top" secondItem="uEV-Dx-GAt" secondAttribute="top" id="Ifa-Vo-0dX"/>
<constraint firstItem="GyG-Cz-Xbp" firstAttribute="leading" secondItem="uEV-Dx-GAt" secondAttribute="leading" constant="16" id="MHk-ZL-muq"/>
<constraint firstAttribute="bottom" secondItem="vzh-eD-yFD" secondAttribute="bottom" constant="4" id="PpP-yU-4nN"/>
<constraint firstItem="GyG-Cz-Xbp" firstAttribute="top" secondItem="htT-X5-unD" secondAttribute="bottom" id="QEn-Hg-oTR"/>
<constraint firstAttribute="trailing" secondItem="jX7-Lb-0ux" secondAttribute="trailing" constant="16" id="S84-tb-TEb"/>
<constraint firstItem="htT-X5-unD" firstAttribute="width" secondItem="uEV-Dx-GAt" secondAttribute="width" multiplier="0.45" id="ZPd-aC-3KN"/>
<constraint firstItem="e9u-lJ-p74" firstAttribute="top" secondItem="uEV-Dx-GAt" secondAttribute="top" constant="4" id="bEv-fT-w33"/>
<constraint firstItem="d5T-hO-XNq" firstAttribute="trailing" secondItem="vzh-eD-yFD" secondAttribute="trailing" id="beu-1M-BV3"/>
<constraint firstAttribute="bottom" secondItem="GyG-Cz-Xbp" secondAttribute="bottom" constant="20" id="br5-mO-bOc"/>
<constraint firstItem="vzh-eD-yFD" firstAttribute="top" secondItem="d5T-hO-XNq" secondAttribute="bottom" constant="2" id="dUy-RK-eUK"/>
<constraint firstItem="GyG-Cz-Xbp" firstAttribute="width" secondItem="uEV-Dx-GAt" secondAttribute="width" multiplier="0.45" id="kAf-Iv-QQY"/>
<constraint firstItem="d5T-hO-XNq" firstAttribute="top" secondItem="jX7-Lb-0ux" secondAttribute="bottom" constant="2" id="lUt-a4-tKe"/>
<constraint firstItem="vzh-eD-yFD" firstAttribute="width" secondItem="uEV-Dx-GAt" secondAttribute="width" multiplier="0.4" id="qHK-SH-tOH"/>
<constraint firstAttribute="trailing" secondItem="d5T-hO-XNq" secondAttribute="trailing" constant="16" id="xNr-ke-CBN"/>
<constraint firstItem="d5T-hO-XNq" firstAttribute="top" secondItem="e9u-lJ-p74" secondAttribute="top" id="tNI-kE-cy4"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
Expand All @@ -102,7 +94,6 @@
<outlet property="location" destination="e9u-lJ-p74" id="Fam-a2-bfa"/>
<outlet property="summaryLabel" destination="GyG-Cz-Xbp" id="qh1-U9-CPI"/>
<outlet property="temperature" destination="htT-X5-unD" id="oKf-6l-OhY"/>
<outlet property="time" destination="jX7-Lb-0ux" id="J7z-lT-QBh"/>
<outlet property="weatherIconImage" destination="vzh-eD-yFD" id="u4E-fv-339"/>
</connections>
</tableViewCell>
Expand Down
12 changes: 6 additions & 6 deletions CFuWx/DarkSkyAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ +(void)fetchCurrentWeatherWithCompletion:(weatherCompletion)completion {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&jsonParsingError];
NSLog(@"JSON LOADS FOR CURRENT WEATHER");
// NSLog(@"JSON LOADS FOR CURRENT WEATHER");
if (error) {
NSLog(@"Error Parsing JSON - Error: %@", jsonParsingError.localizedDescription);
} else {
Expand Down Expand Up @@ -121,7 +121,7 @@ +(void)fetchHourlyWeatherWithCompletion:(weatherCompletionWithArray)completion {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&jsonParsingError];
NSLog(@"JSON LOADS FOR HOURLY WEATHER");
// NSLog(@"JSON LOADS FOR HOURLY WEATHER");
if (error) {
NSLog(@"Error Parsing JSON - Error: %@", jsonParsingError.localizedDescription);
} else {
Expand All @@ -148,7 +148,7 @@ +(void)fetchDailyWeatherWithCompletion:(weatherCompletionWithArray)completion {
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];

[[session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"Response: %@", response);
// NSLog(@"Response: %@", response);

if(error) {
NSLog(@"There was a problem getting current weather data from API - Error: %@", error.localizedDescription);
Expand All @@ -160,15 +160,15 @@ +(void)fetchDailyWeatherWithCompletion:(weatherCompletionWithArray)completion {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&jsonParsingError];
NSLog(@"JSON!!!!!: %@", json);
// NSLog(@"JSON!: %@", json);
if (error) {
NSLog(@"Error Parsing JSON - Error: %@", jsonParsingError.localizedDescription);
} else {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
NSMutableArray *dailyArray = [[NSMutableArray alloc]init];

for (NSDictionary *dailyForecast in [json valueForKeyPath:@"daily.data"]) {
NSLog(@"forecast Icon for daily forecast: %@", dailyForecast[@"icon"]);
// NSLog(@"forecast Icon for daily forecast: %@", dailyForecast[@"icon"]);
Weather *dailyWeather = [[Weather alloc]initWithDictionary:dailyForecast andLatitude:json[@"latitude"] andLongitude:json[@"longitude"]];
[dailyArray addObject:dailyWeather];
}
Expand Down Expand Up @@ -207,7 +207,7 @@ +(void)fetchCurrentWeatherOnLoad:(weatherCompletion)completion {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&jsonParsingError];
NSLog(@"JSON!!!!!: %@", json);
// NSLog(@"JSON!: %@", json);
if (error) {
NSLog(@"Error Parsing JSON - Error: %@", jsonParsingError.localizedDescription);
} else {
Expand Down
25 changes: 16 additions & 9 deletions CFuWx/ForecastViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ - (IBAction)hourlyForecastButtonPressed:(UIButton *)sender {
if([self.forecastToDisplay isEqualToString:@"daily"]) {
self.forecastToDisplay = @"hourly";
[self getHourlyWeatherData];
[self.forecastTableView reloadData];
}
}

- (IBAction)dailyForecastButtonPressed:(UIButton *)sender {
if([self.forecastToDisplay isEqualToString:@"hourly"]) {
self.forecastToDisplay = @"daily";
[self getDailyWeatherData];
[self.forecastTableView reloadData];
}
}

Expand All @@ -68,6 +70,7 @@ - (void)viewDidLoad {
UINib *dailyHeader = [UINib nibWithNibName:@"DailyRowTitles" bundle:nil];
[self.forecastTableView registerNib:dailyHeader forCellReuseIdentifier:@"DailyTableViewCellHeader"];

[self setNeedsStatusBarAppearanceUpdate];
}

-(void)viewDidAppear:(BOOL)animated {
Expand Down Expand Up @@ -112,6 +115,10 @@ -(NSString *)getLocationText {
return [[LocationManager sharedManager] reverseGeocode:location];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}

//MARK: TableViewDelegate Methods

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Expand Down Expand Up @@ -160,15 +167,15 @@ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
}

// still need to fix getting headers to display properly.
//-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
//
// if ([self.forecastToDisplay isEqualToString:@"daily"]) {
// return [[NSBundle mainBundle] loadNibNamed:@"DailyRowTitles" owner:self options:nil].firstObject;
//
// } else {
// return [[NSBundle mainBundle] loadNibNamed:@"HourlyRowTitles" owner:self options:nil].firstObject;
// }
//}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

if ([self.forecastToDisplay isEqualToString:@"hourly"]) {
return [[NSBundle mainBundle] loadNibNamed:@"HourlyRowTitles" owner:self options:nil].firstObject;

} else {
return [[NSBundle mainBundle] loadNibNamed:@"DailyRowTitles" owner:self options:nil].firstObject;
}
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 65;
Expand Down
10 changes: 10 additions & 0 deletions CFuWx/HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ - (void)viewDidLoad {

self.tableView.delegate = self;
self.tableView.dataSource = self;

[self setNeedsStatusBarAppearanceUpdate];
}

-(void)viewDidAppear:(BOOL)animated {
Expand All @@ -73,6 +75,12 @@ -(NSString *)getLocationText {
return [[LocationManager sharedManager] reverseGeocode:location];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}

//MARK: TableViewDataSource Methods

-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

if(indexPath.row == 0) {
Expand Down Expand Up @@ -112,6 +120,8 @@ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)
return 2;
}

//MARK: TableViewDelegate Methods

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 195;
}
Expand Down
2 changes: 2 additions & 0 deletions CFuWx/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand Down
Loading

0 comments on commit 04cbd29

Please sign in to comment.