Commit 67297da30689add2e6f6eab4d6d4b9c96c980a78
1 parent
cc8cf48927
Exists in
master
update icons in all app, add background, fix UI in iphoneX
Showing 80 changed files with 901 additions and 620 deletions Side-by-side Diff
- LifeLog/LifeLog.xcodeproj/project.pbxproj
- LifeLog/LifeLog/AppDelegate.m
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_1x.png
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_2x.png
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_3x.png
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava-1.png
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava-2.png
- LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava.png
- LifeLog/LifeLog/Assets.xcassets/Common/background.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Common/background.imageset/background.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_mail.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Common/icon_mail.imageset/ic_mail.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_1x.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_2x.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_3x.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_other_send.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Common/icon_other_send.imageset/ic_other.png
- LifeLog/LifeLog/Assets.xcassets/Common/icon_twitter.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Common/icon_twitter.imageset/ic_twitter.png
- LifeLog/LifeLog/Assets.xcassets/Rank/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_1.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_1.imageset/ic_rank_1.png
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_2.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_2.imageset/ic_rank_2.png
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_3.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_3.imageset/ic_rank_3.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_1x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_2x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_3x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_1x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_2x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_3x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_1x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_2x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_3x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_1x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_2x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_3x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/Contents.json
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_1x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_2x.png
- LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_3x.png
- LifeLog/LifeLog/CollectionView.h
- LifeLog/LifeLog/CollectionView.m
- LifeLog/LifeLog/CreateGroupViewController.h
- LifeLog/LifeLog/CreateGroupViewController.m
- LifeLog/LifeLog/CreateGroupViewController.xib
- LifeLog/LifeLog/GroupDetailViewController.h
- LifeLog/LifeLog/GroupDetailViewController.m
- LifeLog/LifeLog/GroupDetailViewController.xib
- LifeLog/LifeLog/HistoryViewController.h
- LifeLog/LifeLog/HistoryViewController.m
- LifeLog/LifeLog/HistoryViewController.xib
- LifeLog/LifeLog/HomeViewConb troller.m
- LifeLog/LifeLog/HomeViewController.m
- LifeLog/LifeLog/HomeViewController.xib
- LifeLog/LifeLog/LabelCollectionViewCell.h
- LifeLog/LifeLog/LabelCollectionViewCell.xib
- LifeLog/LifeLog/MapViewController.m
- LifeLog/LifeLog/MyGroupViewController.h
- LifeLog/LifeLog/MyGroupViewController.m
- LifeLog/LifeLog/MyGroupViewController.xib
- LifeLog/LifeLog/RankingTableViewCell.h
- LifeLog/LifeLog/RankingTableViewCell.m
- LifeLog/LifeLog/RankingTableViewCell.xib
- LifeLog/LifeLog/RankingViewController.h
- LifeLog/LifeLog/RankingViewController.m
- LifeLog/LifeLog/RankingViewController.xib
- LifeLog/LifeLog/SNSViewController.h
- LifeLog/LifeLog/SNSViewController.m
- LifeLog/LifeLog/SNSViewController.xib
- LifeLog/LifeLog/SearchGroupViewController.h
- LifeLog/LifeLog/SearchGroupViewController.m
- LifeLog/LifeLog/SearchGroupViewController.xib
- LifeLog/LifeLog/TodayViewController.xib
LifeLog/LifeLog.xcodeproj/project.pbxproj
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | 6E84E3841F27A701001EB88E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6E84E3821F27A701001EB88E /* LaunchScreen.storyboard */; }; |
| 26 | 26 | 6E84E38F1F27A703001EB88E /* LifeLogTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E84E38E1F27A703001EB88E /* LifeLogTests.m */; }; |
| 27 | 27 | 6E84E39A1F27A703001EB88E /* LifeLogUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E84E3991F27A703001EB88E /* LifeLogUITests.m */; }; |
| 28 | - 6E84E3B01F27A975001EB88E /* HomeViewConb troller.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E84E3AE1F27A975001EB88E /* HomeViewConb troller.m */; }; | |
| 28 | + 6E84E3B01F27A975001EB88E /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E84E3AE1F27A975001EB88E /* HomeViewController.m */; }; | |
| 29 | 29 | 6E84E3B11F27A975001EB88E /* HomeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E84E3AF1F27A975001EB88E /* HomeViewController.xib */; }; |
| 30 | 30 | 6E84E3B51F27A98B001EB88E /* HistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E84E3B31F27A98B001EB88E /* HistoryViewController.m */; }; |
| 31 | 31 | 6E84E3B61F27A98B001EB88E /* HistoryViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6E84E3B41F27A98B001EB88E /* HistoryViewController.xib */; }; |
| ... | ... | @@ -137,7 +137,7 @@ |
| 137 | 137 | 6E84E3991F27A703001EB88E /* LifeLogUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LifeLogUITests.m; sourceTree = "<group>"; }; |
| 138 | 138 | 6E84E39B1F27A703001EB88E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
| 139 | 139 | 6E84E3AD1F27A975001EB88E /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; }; |
| 140 | - 6E84E3AE1F27A975001EB88E /* HomeViewConb troller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HomeViewConb troller.m"; sourceTree = "<group>"; }; | |
| 140 | + 6E84E3AE1F27A975001EB88E /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; }; | |
| 141 | 141 | 6E84E3AF1F27A975001EB88E /* HomeViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeViewController.xib; sourceTree = "<group>"; }; |
| 142 | 142 | 6E84E3B21F27A98B001EB88E /* HistoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryViewController.h; sourceTree = "<group>"; }; |
| 143 | 143 | 6E84E3B31F27A98B001EB88E /* HistoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HistoryViewController.m; sourceTree = "<group>"; }; |
| ... | ... | @@ -421,7 +421,7 @@ |
| 421 | 421 | children = ( |
| 422 | 422 | 6E8DA0F31F2BAC0800CCE941 /* Today */, |
| 423 | 423 | 6E84E3AD1F27A975001EB88E /* HomeViewController.h */, |
| 424 | - 6E84E3AE1F27A975001EB88E /* HomeViewConb troller.m */, | |
| 424 | + 6E84E3AE1F27A975001EB88E /* HomeViewController.m */, | |
| 425 | 425 | 6E84E3AF1F27A975001EB88E /* HomeViewController.xib */, |
| 426 | 426 | ); |
| 427 | 427 | name = Home; |
| 428 | 428 | |
| ... | ... | @@ -803,9 +803,20 @@ |
| 803 | 803 | files = ( |
| 804 | 804 | ); |
| 805 | 805 | inputPaths = ( |
| 806 | + "${SRCROOT}/Pods/Target Support Files/Pods-LifeLog/Pods-LifeLog-frameworks.sh", | |
| 807 | + "${BUILT_PRODUCTS_DIR}/Charts/Charts.framework", | |
| 808 | + "${BUILT_PRODUCTS_DIR}/CircleProgressBar/CircleProgressBar.framework", | |
| 809 | + "${BUILT_PRODUCTS_DIR}/LineKit/LineKit.framework", | |
| 810 | + "${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework", | |
| 811 | + "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", | |
| 806 | 812 | ); |
| 807 | 813 | name = "[CP] Embed Pods Frameworks"; |
| 808 | 814 | outputPaths = ( |
| 815 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Charts.framework", | |
| 816 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CircleProgressBar.framework", | |
| 817 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LineKit.framework", | |
| 818 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework", | |
| 819 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", | |
| 809 | 820 | ); |
| 810 | 821 | runOnlyForDeploymentPostprocessing = 0; |
| 811 | 822 | shellPath = /bin/sh; |
| 812 | 823 | |
| 813 | 824 | |
| ... | ... | @@ -818,13 +829,16 @@ |
| 818 | 829 | files = ( |
| 819 | 830 | ); |
| 820 | 831 | inputPaths = ( |
| 832 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | |
| 833 | + "${PODS_ROOT}/Manifest.lock", | |
| 821 | 834 | ); |
| 822 | 835 | name = "[CP] Check Pods Manifest.lock"; |
| 823 | 836 | outputPaths = ( |
| 837 | + "$(DERIVED_FILE_DIR)/Pods-LifeLog-checkManifestLockResult.txt", | |
| 824 | 838 | ); |
| 825 | 839 | runOnlyForDeploymentPostprocessing = 0; |
| 826 | 840 | shellPath = /bin/sh; |
| 827 | - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; | |
| 841 | + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | |
| 828 | 842 | showEnvVarsInLog = 0; |
| 829 | 843 | }; |
| 830 | 844 | 96653BDB2C24A87C2866C897 /* [CP] Copy Pods Resources */ = { |
| ... | ... | @@ -863,7 +877,7 @@ |
| 863 | 877 | E9D909211F3D559D004CF99F /* TweetObject.m in Sources */, |
| 864 | 878 | 6E48AF0D1F2F9D3300C1D184 /* CustomTextField.m in Sources */, |
| 865 | 879 | E99E13AB1F336F3600C78787 /* CollectionView.m in Sources */, |
| 866 | - 6E84E3B01F27A975001EB88E /* HomeViewConb troller.m in Sources */, | |
| 880 | + 6E84E3B01F27A975001EB88E /* HomeViewController.m in Sources */, | |
| 867 | 881 | E9373E471F3596940059355A /* AutoTransLabel.m in Sources */, |
| 868 | 882 | 6E27A74A1F9E41B400C390B3 /* HomeObject.m in Sources */, |
| 869 | 883 | 6E84E3791F27A701001EB88E /* AppDelegate.m in Sources */, |
LifeLog/LifeLog/AppDelegate.m
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
| 30 | 30 | // Override point for customization after application launch. |
| 31 | 31 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; |
| 32 | - | |
| 32 | + [[UITabBar appearance] setBackgroundColor:[UIColor whiteColor]]; | |
| 33 | 33 | NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; |
| 34 | 34 | User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; |
| 35 | 35 | if (user == nil) { |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | |
| ... | ... | @@ -89,26 +89,31 @@ |
| 89 | 89 | |
| 90 | 90 | HomeViewController *homeVC = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil]; |
| 91 | 91 | UINavigationController *naviToday = [[UINavigationController alloc] initWithRootViewController:homeVC]; |
| 92 | - naviToday.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"lifelog.tapbar.today", @"") image:[UIImage imageNamed:@"tapbar_today"] tag:1]; | |
| 92 | + naviToday.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tapbar_today"] tag:1]; | |
| 93 | + naviToday.tabBarItem.imageInsets = UIEdgeInsetsMake(9, 0, -9, 0); | |
| 93 | 94 | naviToday.navigationBar.hidden = YES; |
| 94 | 95 | |
| 95 | 96 | HistoryViewController *historyVC = [[HistoryViewController alloc] initWithNibName:@"HistoryViewController" bundle:nil]; |
| 96 | 97 | UINavigationController *naviHistory = [[UINavigationController alloc] initWithRootViewController:historyVC]; |
| 97 | - naviHistory.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"lifelog.tapbar.history", @"") image:[UIImage imageNamed:@"tapbar_history"] tag:2]; | |
| 98 | + naviHistory.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tapbar_history"] tag:2]; | |
| 99 | + naviHistory.tabBarItem.imageInsets = UIEdgeInsetsMake(9, 0, -9, 0); | |
| 98 | 100 | naviHistory.navigationBar.hidden = YES; |
| 99 | 101 | |
| 100 | 102 | RankingViewController *rankingVC = [[RankingViewController alloc] initWithNibName:@"RankingViewController" bundle:nil]; |
| 101 | 103 | UINavigationController *naviRanking = [[UINavigationController alloc] initWithRootViewController:rankingVC]; |
| 102 | - naviRanking.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"lifelog.tapbar.ranking", @"") image:[UIImage imageNamed:@"tapbar_ranking"] tag:3]; | |
| 104 | + naviRanking.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tapbar_ranking"] tag:3]; | |
| 105 | + naviRanking.tabBarItem.imageInsets = UIEdgeInsetsMake(9, 0, -9, 0); | |
| 103 | 106 | naviRanking.navigationBar.hidden = YES; |
| 104 | 107 | |
| 105 | 108 | MapViewController *mapVC = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil]; |
| 106 | 109 | UINavigationController *naviMap = [[UINavigationController alloc] initWithRootViewController:mapVC]; |
| 107 | - naviMap.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"lifelog.tapbar.map", @"") image:[UIImage imageNamed:@"tapbar_map"] tag:4]; | |
| 108 | - | |
| 110 | + naviMap.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tapbar_map"] tag:4]; | |
| 111 | + naviMap.tabBarItem.imageInsets = UIEdgeInsetsMake(9, 0, -9, 0); | |
| 112 | + | |
| 109 | 113 | SNSViewController *snsVC = [[SNSViewController alloc] initWithNibName:@"SNSViewController" bundle:nil]; |
| 110 | 114 | UINavigationController *naviSNS = [[UINavigationController alloc] initWithRootViewController:snsVC]; |
| 111 | - naviSNS.tabBarItem = [[UITabBarItem alloc] initWithTitle:NSLocalizedString(@"lifelog.tapbar.sns", @"") image:[UIImage imageNamed:@"tapbar_sns"] tag:5]; | |
| 115 | + naviSNS.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"" image:[UIImage imageNamed:@"tapbar_sns"] tag:5]; | |
| 116 | + naviSNS.tabBarItem.imageInsets = UIEdgeInsetsMake(9, 0, -9, 0); | |
| 112 | 117 | naviSNS.navigationBar.hidden = YES; |
| 113 | 118 | |
| 114 | 119 | tabBarViewController.viewControllers = [NSArray arrayWithObjects:naviToday, naviHistory, naviRanking, naviMap, naviSNS, nil]; |
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/Contents.json
| ... | ... | @@ -2,17 +2,17 @@ |
| 2 | 2 | "images" : [ |
| 3 | 3 | { |
| 4 | 4 | "idiom" : "universal", |
| 5 | - "filename" : "avatar_default_1x.png", | |
| 5 | + "filename" : "ic_ava-2.png", | |
| 6 | 6 | "scale" : "1x" |
| 7 | 7 | }, |
| 8 | 8 | { |
| 9 | 9 | "idiom" : "universal", |
| 10 | - "filename" : "avatar_default_2x.png", | |
| 10 | + "filename" : "ic_ava.png", | |
| 11 | 11 | "scale" : "2x" |
| 12 | 12 | }, |
| 13 | 13 | { |
| 14 | 14 | "idiom" : "universal", |
| 15 | - "filename" : "avatar_default_3x.png", | |
| 15 | + "filename" : "ic_ava-1.png", | |
| 16 | 16 | "scale" : "3x" |
| 17 | 17 | } |
| 18 | 18 | ], |
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_1x.png
2.95 KB
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_2x.png
6.42 KB
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/avatar_default_3x.png
12.3 KB
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava-1.png
22.4 KB
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava-2.png
22.4 KB
LifeLog/LifeLog/Assets.xcassets/Common/avatar_default.imageset/ic_ava.png
22.4 KB
LifeLog/LifeLog/Assets.xcassets/Common/background.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "background.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Common/background.imageset/background.png
132 KB
LifeLog/LifeLog/Assets.xcassets/Common/icon_mail.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_mail.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Common/icon_mail.imageset/ic_mail.png
7.3 KB
LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_1x.png
LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_2x.png
LifeLog/LifeLog/Assets.xcassets/Common/icon_menu.imageset/icon_menu_3x.png
LifeLog/LifeLog/Assets.xcassets/Common/icon_other_send.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_other.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Common/icon_other_send.imageset/ic_other.png
4.87 KB
LifeLog/LifeLog/Assets.xcassets/Common/icon_twitter.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_twitter.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Common/icon_twitter.imageset/ic_twitter.png
8.18 KB
LifeLog/LifeLog/Assets.xcassets/Rank/Contents.json
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_1.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_rank_1.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_1.imageset/ic_rank_1.png
8.71 KB
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_2.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_rank_2.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_2.imageset/ic_rank_2.png
8.87 KB
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_3.imageset/Contents.json
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "ic_rank_3.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} |
LifeLog/LifeLog/Assets.xcassets/Rank/ic_rank_3.imageset/ic_rank_3.png
9.62 KB
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/Contents.json
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_1x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_2x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_history.imageset/tapbar_history_3x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/Contents.json
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_1x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_2x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_map.imageset/tapbar_map_3x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/Contents.json
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_1x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_2x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_ranking.imageset/tapbar_ranking_3x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/Contents.json
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_1x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_2x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_sns.imageset/tapbar_sns_3x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/Contents.json
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_1x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_2x.png
LifeLog/LifeLog/Assets.xcassets/Tapbar/tapbar_today.imageset/tapbar_today_3x.png
LifeLog/LifeLog/CollectionView.h
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | int _selectedIndex; |
| 14 | 14 | |
| 15 | 15 | BOOL _isEnableSelection; |
| 16 | + BOOL _isEnableIcon; | |
| 16 | 17 | float _spacing; |
| 17 | 18 | float _cornerRadius; |
| 18 | 19 | |
| ... | ... | @@ -35,7 +36,7 @@ |
| 35 | 36 | -(void) setSelectedIndex: (int) index; |
| 36 | 37 | -(void) setNormalColor: (UIColor *) normal highlightColor: (UIColor *) highlight textColor: (UIColor *) text; |
| 37 | 38 | -(void) setArrayTitle: (NSArray *) title; |
| 38 | - | |
| 39 | +-(void) enableImageIcon; | |
| 39 | 40 | -(int) getCurrentIndex; |
| 40 | 41 | |
| 41 | 42 | @end |
LifeLog/LifeLog/CollectionView.m
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | _textColor = [UIColor blackColor]; |
| 27 | 27 | _isEnableSelection = true; |
| 28 | 28 | _selectedIndex = 0; |
| 29 | + _isEnableIcon = false; | |
| 29 | 30 | } |
| 30 | 31 | return self; |
| 31 | 32 | } |
| ... | ... | @@ -73,6 +74,10 @@ |
| 73 | 74 | return _selectedIndex; |
| 74 | 75 | } |
| 75 | 76 | |
| 77 | +-(void) enableImageIcon { | |
| 78 | + _isEnableIcon = true; | |
| 79 | +} | |
| 80 | + | |
| 76 | 81 | #pragma mark - UICollectionView Delegate |
| 77 | 82 | - (NSInteger) numberOfSectionsInCollectionView:(UICollectionView *)collectionView { |
| 78 | 83 | return 1; |
| ... | ... | @@ -84,10 +89,16 @@ |
| 84 | 89 | |
| 85 | 90 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { |
| 86 | 91 | LabelCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"LabelCell" forIndexPath:indexPath]; |
| 87 | - cell.lblTitle.text = [_arrayTitle objectAtIndex:indexPath.row]; | |
| 88 | - cell.lblTitle.textColor = _textColor; | |
| 89 | - cell.lblTitle.layer.cornerRadius = _cornerRadius; | |
| 90 | - cell.lblTitle.backgroundColor = (indexPath.row == _selectedIndex) ? _highlightColor : _normalColor; | |
| 92 | + cell.imgIcon.hidden = !_isEnableIcon; | |
| 93 | + cell.lblTitle.hidden = _isEnableIcon; | |
| 94 | + if(_isEnableIcon) { | |
| 95 | + cell.imgIcon.image = [UIImage imageNamed:[_arrayTitle objectAtIndex:indexPath.row]]; | |
| 96 | + } else { | |
| 97 | + cell.lblTitle.text = [_arrayTitle objectAtIndex:indexPath.row]; | |
| 98 | + cell.lblTitle.textColor = _textColor; | |
| 99 | + cell.lblTitle.layer.cornerRadius = _cornerRadius; | |
| 100 | + cell.lblTitle.backgroundColor = (indexPath.row == _selectedIndex) ? _highlightColor : _normalColor; | |
| 101 | + } | |
| 91 | 102 | return cell; |
| 92 | 103 | } |
| 93 | 104 |
LifeLog/LifeLog/CreateGroupViewController.h
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | @interface CreateGroupViewController : BaseViewController<UITextFieldDelegate, UITextViewDelegate> |
| 16 | 16 | |
| 17 | +@property (weak, nonatomic) IBOutlet UIView *viewHeader; | |
| 17 | 18 | @property (weak, nonatomic) IBOutlet UITextField *textName; |
| 18 | 19 | @property (weak, nonatomic) IBOutlet UITextField *textGoalWalk; |
| 19 | 20 | @property (weak, nonatomic) IBOutlet UITextField *textGoalRun; |
LifeLog/LifeLog/CreateGroupViewController.m
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | |
| 18 | 18 | - (void)viewDidLoad { |
| 19 | 19 | [super viewDidLoad]; |
| 20 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 20 | 21 | // Do any additional setup after loading the view from its nib. |
| 21 | 22 | } |
| 22 | 23 |
LifeLog/LifeLog/CreateGroupViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> |
| 9 | 10 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 10 | 11 | </dependencies> |
| ... | ... | @@ -23,6 +24,7 @@ |
| 23 | 24 | <outlet property="textGoalWalk" destination="4JZ-J2-3D9" id="yHV-mB-rcn"/> |
| 24 | 25 | <outlet property="textName" destination="pXO-K0-vne" id="ePQ-35-RLr"/> |
| 25 | 26 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| 27 | + <outlet property="viewHeader" destination="QYv-QM-Bkk" id="LYm-el-WYU"/> | |
| 26 | 28 | </connections> |
| 27 | 29 | </placeholder> |
| 28 | 30 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -564,7 +566,7 @@ |
| 564 | 566 | <state key="normal" image="icon_menu"/> |
| 565 | 567 | </button> |
| 566 | 568 | </subviews> |
| 567 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 569 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 568 | 570 | <constraints> |
| 569 | 571 | <constraint firstAttribute="trailing" secondItem="9hM-Gv-AxQ" secondAttribute="trailing" id="5f8-Xt-vKd"/> |
| 570 | 572 | <constraint firstAttribute="bottom" secondItem="9hM-Gv-AxQ" secondAttribute="bottom" id="Q3z-hF-VbV"/> |
| ... | ... | @@ -586,7 +588,7 @@ |
| 586 | 588 | <constraint firstAttribute="trailing" secondItem="aKu-bd-xMP" secondAttribute="trailing" id="WAl-wE-FB4"/> |
| 587 | 589 | <constraint firstAttribute="trailing" secondItem="QYv-QM-Bkk" secondAttribute="trailing" id="XdX-OA-ALX"/> |
| 588 | 590 | <constraint firstItem="aKu-bd-xMP" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="cE7-y5-LL4"/> |
| 589 | - <constraint firstItem="QYv-QM-Bkk" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="dAn-YE-2s3"/> | |
| 591 | + <constraint firstItem="QYv-QM-Bkk" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="dAn-YE-2s3"/> | |
| 590 | 592 | <constraint firstItem="QYv-QM-Bkk" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="fFF-bj-0uk"/> |
| 591 | 593 | <constraint firstAttribute="bottom" secondItem="aKu-bd-xMP" secondAttribute="bottom" id="oPE-ST-BIo"/> |
| 592 | 594 | </constraints> |
LifeLog/LifeLog/GroupDetailViewController.h
LifeLog/LifeLog/GroupDetailViewController.m
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | |
| 22 | 22 | - (void)viewDidLoad { |
| 23 | 23 | [super viewDidLoad]; |
| 24 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 24 | 25 | isMemberList = false; |
| 25 | 26 | //register nib for table view |
| 26 | 27 | [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; |
LifeLog/LifeLog/GroupDetailViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 9 | 10 | </dependencies> |
| 10 | 11 | <objects> |
| ... | ... | @@ -18,6 +19,7 @@ |
| 18 | 19 | <outlet property="lblGrpName" destination="YWV-pS-TCo" id="VeU-Ov-uSD"/> |
| 19 | 20 | <outlet property="tableBase" destination="4VU-Ye-7Au" id="m1e-cS-Sxf"/> |
| 20 | 21 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| 22 | + <outlet property="viewHeader" destination="25d-3H-0fr" id="yBY-1c-Qeh"/> | |
| 21 | 23 | </connections> |
| 22 | 24 | </placeholder> |
| 23 | 25 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -55,7 +57,7 @@ |
| 55 | 57 | <state key="normal" image="icon_menu"/> |
| 56 | 58 | </button> |
| 57 | 59 | </subviews> |
| 58 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 60 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 59 | 61 | <constraints> |
| 60 | 62 | <constraint firstItem="y09-DG-Krp" firstAttribute="top" secondItem="25d-3H-0fr" secondAttribute="top" id="65z-ZM-a3D"/> |
| 61 | 63 | <constraint firstItem="O3M-Ba-zHF" firstAttribute="leading" secondItem="25d-3H-0fr" secondAttribute="leading" id="CQk-IB-W9y"/> |
| ... | ... | @@ -156,7 +158,7 @@ |
| 156 | 158 | </subviews> |
| 157 | 159 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
| 158 | 160 | <constraints> |
| 159 | - <constraint firstItem="25d-3H-0fr" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5o2-0w-AL5"/> | |
| 161 | + <constraint firstItem="25d-3H-0fr" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="5o2-0w-AL5"/> | |
| 160 | 162 | <constraint firstAttribute="trailing" secondItem="25d-3H-0fr" secondAttribute="trailing" id="7IX-2R-C0n"/> |
| 161 | 163 | <constraint firstItem="O8z-6V-YFd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="15" id="81K-BQ-6tU"/> |
| 162 | 164 | <constraint firstAttribute="bottom" secondItem="4VU-Ye-7Au" secondAttribute="bottom" constant="50" id="GKY-NB-YYF"/> |
LifeLog/LifeLog/HistoryViewController.h
LifeLog/LifeLog/HistoryViewController.m
| ... | ... | @@ -21,8 +21,9 @@ |
| 21 | 21 | - (void)viewDidLoad { |
| 22 | 22 | [super viewDidLoad]; |
| 23 | 23 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.viewCollectionMode attribute:NSLayoutAttributeBottom multiplier:1 constant:0]]; |
| 24 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 24 | 25 | // Do any additional setup after loading the view from its nib. |
| 25 | - self.title = NSLocalizedString(@"lifelog.history.title", nil); | |
| 26 | +// self.title = NSLocalizedString(@"lifelog.history.title", nil); | |
| 26 | 27 | |
| 27 | 28 | _isDisableLoadMore = true; |
| 28 | 29 | |
| 29 | 30 | |
| ... | ... | @@ -78,12 +79,12 @@ |
| 78 | 79 | } |
| 79 | 80 | }; |
| 80 | 81 | |
| 81 | - NSArray *shareTitle = [NSArray arrayWithObjects:NSLocalizedString(@"lifelog.history.share.1", nil), NSLocalizedString(@"lifelog.history.share.2", nil), NSLocalizedString(@"lifelog.history.share.3", nil), NSLocalizedString(@"lifelog.history.share.4", nil), NSLocalizedString(@"lifelog.history.share.5", nil), nil]; | |
| 82 | + NSArray *shareTitle = [NSArray arrayWithObjects:@"icon_facebook", @"icon_twitter", @"icon_line", @"icon_mail", @"icon_other_send", nil]; | |
| 82 | 83 | [self.viewCollectionShare setButtonNumber:typeTitle.count]; |
| 83 | 84 | [self.viewCollectionShare setSpacing:3]; |
| 84 | 85 | [self.viewCollectionShare setArrayTitle:shareTitle]; |
| 85 | 86 | [self.viewCollectionShare disableSelection]; |
| 86 | - | |
| 87 | + [self.viewCollectionShare enableImageIcon]; | |
| 87 | 88 | //add tap gesture for enable tap on gesture on CollectionView in ScrollView |
| 88 | 89 | UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureAction:)]; |
| 89 | 90 | [recognizer setNumberOfTapsRequired:1]; |
LifeLog/LifeLog/HistoryViewController.xib
| ... | ... | @@ -28,6 +28,7 @@ |
| 28 | 28 | <outlet property="viewCollectionMode" destination="BVv-qD-EHM" id="A6n-32-oxg"/> |
| 29 | 29 | <outlet property="viewCollectionShare" destination="Iw2-nW-e7g" id="LW3-j0-yEY"/> |
| 30 | 30 | <outlet property="viewCollectionType" destination="yxY-4d-tB6" id="K1D-Gc-kWV"/> |
| 31 | + <outlet property="viewHeader" destination="clL-JG-rbd" id="4NQ-RP-UeO"/> | |
| 31 | 32 | </connections> |
| 32 | 33 | </placeholder> |
| 33 | 34 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -35,6 +36,9 @@ |
| 35 | 36 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
| 36 | 37 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
| 37 | 38 | <subviews> |
| 39 | + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="background" translatesAutoresizingMaskIntoConstraints="NO" id="3GJ-xw-Zoa"> | |
| 40 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
| 41 | + </imageView> | |
| 38 | 42 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="clL-JG-rbd" userLabel="ViewHeader"> |
| 39 | 43 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> |
| 40 | 44 | <subviews> |
| ... | ... | @@ -62,7 +66,7 @@ |
| 62 | 66 | <state key="normal" image="icon_menu"/> |
| 63 | 67 | </button> |
| 64 | 68 | </subviews> |
| 65 | - <color key="backgroundColor" red="0.098039215686274508" green="0.098039215686274508" blue="0.098039215686274508" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 69 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 66 | 70 | <constraints> |
| 67 | 71 | <constraint firstAttribute="trailing" secondItem="Ht6-rd-JXF" secondAttribute="trailing" id="Fr9-Yj-q5e"/> |
| 68 | 72 | <constraint firstItem="ytc-zM-ZGC" firstAttribute="leading" secondItem="clL-JG-rbd" secondAttribute="leading" id="LDb-Pq-Z5k"/> |
| 69 | 73 | |
| 70 | 74 | |
| 71 | 75 | |
| 72 | 76 | |
| ... | ... | @@ -475,18 +479,22 @@ |
| 475 | 479 | <constraint firstItem="clL-JG-rbd" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="3tf-ab-v41"/> |
| 476 | 480 | <constraint firstItem="Cf1-lP-zbB" firstAttribute="top" secondItem="clL-JG-rbd" secondAttribute="bottom" id="5vy-x5-G38"/> |
| 477 | 481 | <constraint firstItem="Cf1-lP-zbB" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="10" id="974-wJ-aRb"/> |
| 482 | + <constraint firstItem="3GJ-xw-Zoa" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="HBx-Na-cDr"/> | |
| 478 | 483 | <constraint firstItem="yxY-4d-tB6" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="2" id="Jqg-nE-6dv"/> |
| 479 | 484 | <constraint firstAttribute="trailing" secondItem="BVv-qD-EHM" secondAttribute="trailing" id="MCi-Tl-hSp"/> |
| 485 | + <constraint firstAttribute="trailing" secondItem="3GJ-xw-Zoa" secondAttribute="trailing" id="Moq-8p-WQZ"/> | |
| 480 | 486 | <constraint firstAttribute="trailing" secondItem="yxY-4d-tB6" secondAttribute="trailing" constant="2" id="Qs5-ky-nmB"/> |
| 481 | 487 | <constraint firstAttribute="bottom" secondItem="BVv-qD-EHM" secondAttribute="bottom" constant="50" placeholder="YES" id="SbT-PG-8MJ"/> |
| 482 | 488 | <constraint firstItem="BVv-qD-EHM" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="SqH-AA-Z2K"/> |
| 489 | + <constraint firstItem="3GJ-xw-Zoa" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="bcl-n4-1Vp"/> | |
| 483 | 490 | <constraint firstItem="FLa-rV-Aas" firstAttribute="top" secondItem="yxY-4d-tB6" secondAttribute="bottom" constant="15" id="cWw-RX-1Kp"/> |
| 484 | 491 | <constraint firstItem="yxY-4d-tB6" firstAttribute="top" secondItem="Cf1-lP-zbB" secondAttribute="bottom" constant="15" id="dSN-ey-gQ7"/> |
| 485 | - <constraint firstItem="clL-JG-rbd" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="i5Z-XR-Msb"/> | |
| 492 | + <constraint firstItem="clL-JG-rbd" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="i5Z-XR-Msb"/> | |
| 486 | 493 | <constraint firstItem="FLa-rV-Aas" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="iiN-Zj-1uu"/> |
| 487 | 494 | <constraint firstAttribute="trailing" secondItem="FLa-rV-Aas" secondAttribute="trailing" id="jme-cz-cFt"/> |
| 488 | 495 | <constraint firstItem="BVv-qD-EHM" firstAttribute="top" secondItem="FLa-rV-Aas" secondAttribute="bottom" constant="5" id="qbT-yT-phN"/> |
| 489 | 496 | <constraint firstAttribute="trailing" secondItem="clL-JG-rbd" secondAttribute="trailing" id="ri5-LG-xJH"/> |
| 497 | + <constraint firstAttribute="bottom" secondItem="3GJ-xw-Zoa" secondAttribute="bottom" id="uCd-co-Zew"/> | |
| 490 | 498 | </constraints> |
| 491 | 499 | <point key="canvasLocation" x="26.5" y="52.5"/> |
| 492 | 500 | </view> |
| ... | ... | @@ -504,6 +512,7 @@ |
| 504 | 512 | <resources> |
| 505 | 513 | <image name="arrow_back" width="22" height="22"/> |
| 506 | 514 | <image name="arrow_next" width="22" height="22"/> |
| 515 | + <image name="background" width="1563" height="2778"/> | |
| 507 | 516 | <image name="icon_menu" width="30" height="30"/> |
| 508 | 517 | <image name="today_back_button" width="73" height="37"/> |
| 509 | 518 | </resources> |
LifeLog/LifeLog/HomeViewConb troller.m
| 1 | -// | |
| 2 | -// HomeViewController.m | |
| 3 | -// LifeLog | |
| 4 | -// | |
| 5 | -// Created by Nguyen Van Phong on 7/25/17. | |
| 6 | -// Copyright ยฉ 2017 PhongNV. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "HomeViewController.h" | |
| 10 | -#import "NSDate+helper.h" | |
| 11 | -#import <CoreMotion/CoreMotion.h> | |
| 12 | -#import "CMMotionActivityExtra.h" | |
| 13 | -#import "TodayViewController.h" | |
| 14 | -#import "Utilities.h" | |
| 15 | -#import <MBProgressHUD/MBProgressHUD.h> | |
| 16 | -#import "ServerAPI.h" | |
| 17 | - | |
| 18 | -static NSInteger maxRequest = 20; | |
| 19 | -static NSInteger numberTotal = 10000; | |
| 20 | - | |
| 21 | -@interface HomeViewController () | |
| 22 | -{ | |
| 23 | - MBProgressHUD *progressHud; | |
| 24 | - NSInteger targetStep; | |
| 25 | -} | |
| 26 | -@property (nonatomic, weak) IBOutlet UILabel *lblTitle; | |
| 27 | -@property (nonatomic, weak) IBOutlet UIImageView *avatar; | |
| 28 | -@property (nonatomic, weak) IBOutlet UILabel *lblDateCurrent; | |
| 29 | -@property (nonatomic, weak) IBOutlet UILabel *lblValueStep; | |
| 30 | -@property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; | |
| 31 | -@property (nonatomic, weak) IBOutlet UILabel *lblValueStepOther; | |
| 32 | -@property (nonatomic, weak) IBOutlet UILabel *lblPercent; | |
| 33 | -@property (nonatomic, weak) IBOutlet UILabel *lblNotice; | |
| 34 | -@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentHome; | |
| 35 | -@property (weak, nonatomic) IBOutlet UITextView *tvNotice; | |
| 36 | - | |
| 37 | -@property (nonatomic, strong) CMPedometer *pedometer; | |
| 38 | -@property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; | |
| 39 | -@property (nonatomic, strong) NSOperationQueue *operationQueue; | |
| 40 | -@property (nonatomic, strong) NSTimer *timer; | |
| 41 | -@property (nonatomic, assign) NSInteger bike; | |
| 42 | -@property (nonatomic, assign) NSInteger walking; | |
| 43 | -@property (nonatomic, assign) NSInteger running; | |
| 44 | -@property (nonatomic, strong) NSDate *dateCurrent; | |
| 45 | - | |
| 46 | -@property (nonatomic, assign) int totalRequest; | |
| 47 | -@property (nonatomic, assign) int countComplete; | |
| 48 | -@property (nonatomic, assign) int currentIndex; | |
| 49 | - | |
| 50 | -@end | |
| 51 | - | |
| 52 | -@implementation HomeViewController | |
| 53 | - | |
| 54 | -- (void)viewDidLoad { | |
| 55 | - [super viewDidLoad]; | |
| 56 | - | |
| 57 | - self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); | |
| 58 | - | |
| 59 | - [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 60 | - [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.segmentHome attribute:NSLayoutAttributeBottom multiplier:1 constant:20]]; | |
| 61 | - | |
| 62 | - self.avatar.backgroundColor = [UIColor whiteColor]; | |
| 63 | - self.avatar.layer.borderWidth = 2.0f; | |
| 64 | - self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; | |
| 65 | - self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; | |
| 66 | - self.avatar.layer.masksToBounds = YES; | |
| 67 | - NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; | |
| 68 | - User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; | |
| 69 | - if (user != nil) { | |
| 70 | - NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; | |
| 71 | - NSURL *urlImage = [NSURL URLWithString:linkImage]; | |
| 72 | - NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
| 73 | - sessionConfig.timeoutIntervalForRequest = 30.0; | |
| 74 | - sessionConfig.timeoutIntervalForResource = 60.0; | |
| 75 | - sessionConfig.HTTPMaximumConnectionsPerHost = 20; | |
| 76 | - sessionConfig.allowsCellularAccess = YES; | |
| 77 | - HomeViewController __weak *weakSelf = self; | |
| 78 | - NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; | |
| 79 | - NSURLSessionDataTask *downloadPhotoTask = [session | |
| 80 | - dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
| 81 | - if (weakSelf == nil) | |
| 82 | - { | |
| 83 | - return; | |
| 84 | - } | |
| 85 | - if (error == nil) { | |
| 86 | - UIImage *image = [[UIImage alloc] initWithData:data]; | |
| 87 | - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | |
| 88 | - weakSelf.avatar.image = image; | |
| 89 | - }]; | |
| 90 | - } | |
| 91 | - }]; | |
| 92 | - [downloadPhotoTask resume]; | |
| 93 | - } | |
| 94 | - | |
| 95 | - self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); | |
| 96 | - | |
| 97 | - _dateCurrent = [NSDate date]; | |
| 98 | - self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 99 | - | |
| 100 | - self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | |
| 101 | - | |
| 102 | - if ([CMPedometer isStepCountingAvailable]) { | |
| 103 | - _pedometer = [[CMPedometer alloc] init]; | |
| 104 | - } | |
| 105 | - if ([CMMotionActivityManager isActivityAvailable]) { | |
| 106 | - _motionActivityManager = [[CMMotionActivityManager alloc] init]; | |
| 107 | - } | |
| 108 | - _operationQueue = [[NSOperationQueue alloc] init]; | |
| 109 | - _bike = 0; | |
| 110 | - _walking = 0; | |
| 111 | - _running = 0; | |
| 112 | - _segmentHome.selectedSegmentIndex = 1; | |
| 113 | - _totalRequest = 0; | |
| 114 | - _countComplete = 0; | |
| 115 | - | |
| 116 | - progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
| 117 | - progressHud.mode = MBProgressHUDModeIndeterminate; | |
| 118 | - progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); | |
| 119 | - // [self saveDataStep7LastDay]; | |
| 120 | - targetStep = numberTotal; | |
| 121 | - [self requestNotice]; | |
| 122 | -} | |
| 123 | - | |
| 124 | -- (void)requestNotice | |
| 125 | -{ | |
| 126 | - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 127 | - [dateFormatter setDateFormat:@"yyyy-MM-dd"]; | |
| 128 | - NSString *dateString = [dateFormatter stringFromDate:_dateCurrent]; | |
| 129 | - HomeViewController __weak *weakSelf = self; | |
| 130 | - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| 131 | - //Do background work | |
| 132 | - [[ServerAPI server] getNoticeByDate:dateString CompletionHandler:^(NSArray *arrResults, NSError *error) { | |
| 133 | - if(weakSelf == nil) { | |
| 134 | - return ; | |
| 135 | - } | |
| 136 | - if (error == nil) { | |
| 137 | - // NSLog(@"List Notices: %@", arrResults); | |
| 138 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 139 | - NSString *stringNotice = @""; | |
| 140 | - for (NSString *noticeInfor in arrResults) { | |
| 141 | - NSString *noticeString = [NSString stringWithFormat:@"%@\n", noticeInfor]; | |
| 142 | - stringNotice = [stringNotice stringByAppendingString:noticeString]; | |
| 143 | - } | |
| 144 | - weakSelf.tvNotice.text = stringNotice; | |
| 145 | - }); | |
| 146 | - } | |
| 147 | - else { | |
| 148 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 149 | - weakSelf.tvNotice.text = @""; | |
| 150 | - /* | |
| 151 | - NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 152 | - [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 153 | - */ | |
| 154 | - }); | |
| 155 | - } | |
| 156 | - }]; | |
| 157 | - }); | |
| 158 | -} | |
| 159 | - | |
| 160 | -- (void)viewWillAppear:(BOOL)animated { | |
| 161 | - [super viewWillAppear:animated]; | |
| 162 | - NSDate *dateNow = [NSDate date]; | |
| 163 | - [self saveStepForDay:dateNow]; | |
| 164 | -} | |
| 165 | - | |
| 166 | -- (void)requestTopByDate:(NSDate *)date { | |
| 167 | - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 168 | - [dateFormatter setDateFormat:@"yyyy-MM-dd"]; | |
| 169 | - NSString *dateString = [dateFormatter stringFromDate:date]; | |
| 170 | - [progressHud showAnimated:YES]; | |
| 171 | - [progressHud setHidden:NO]; | |
| 172 | - HomeViewController __weak *weakSelf = self; | |
| 173 | - int mode = 1; | |
| 174 | - switch (_segmentHome.selectedSegmentIndex) { | |
| 175 | - case 0: | |
| 176 | - mode = 3; | |
| 177 | - break; | |
| 178 | - | |
| 179 | - case 1: | |
| 180 | - mode = 1; | |
| 181 | - break; | |
| 182 | - | |
| 183 | - case 2: | |
| 184 | - mode = 2; | |
| 185 | - break; | |
| 186 | - | |
| 187 | - default: | |
| 188 | - break; | |
| 189 | - } | |
| 190 | - [[ServerAPI server] requestTopWithMode:mode andDate:dateString CompletionHandler:^(TopObject *topObject, NSError *error) { | |
| 191 | - if(weakSelf == nil) { | |
| 192 | - return ; | |
| 193 | - } | |
| 194 | - if (error == nil) { | |
| 195 | - NSLog(@"TopObject: %@", topObject); | |
| 196 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 197 | - [weakSelf updateStepUI:topObject.targetInfor]; | |
| 198 | - }); | |
| 199 | - } | |
| 200 | - else { | |
| 201 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 202 | - NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 203 | - [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 204 | - }); | |
| 205 | - } | |
| 206 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 207 | - [progressHud setHidden:YES]; | |
| 208 | - }); | |
| 209 | - }]; | |
| 210 | - /* | |
| 211 | - [[ServerAPI server] requestHomeWithMode:mode andDate:dateString CompletionHandler:^(HomeObject *homeObject, NSError *error) { | |
| 212 | - if(weakSelf == nil) { | |
| 213 | - return ; | |
| 214 | - } | |
| 215 | - if (error == nil) { | |
| 216 | - NSLog(@"List Notices: %@", homeObject.listNotice); | |
| 217 | - for (NoticeInfor *noticeInfor in homeObject.listNotice) { | |
| 218 | - NSLog(@"noticeInfor: %@", noticeInfor.notice_content); | |
| 219 | - } | |
| 220 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 221 | - [weakSelf updateNoticeUI:homeObject]; | |
| 222 | - }); | |
| 223 | - } | |
| 224 | - else { | |
| 225 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 226 | - NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 227 | - [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 228 | - }); | |
| 229 | - } | |
| 230 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 231 | - [progressHud setHidden:YES]; | |
| 232 | - }); | |
| 233 | - }]; | |
| 234 | - */ | |
| 235 | -} | |
| 236 | - | |
| 237 | -- (void)viewWillDisappear:(BOOL)animated { | |
| 238 | - [super viewWillDisappear:animated]; | |
| 239 | -} | |
| 240 | - | |
| 241 | -- (void)didReceiveMemoryWarning { | |
| 242 | - [super didReceiveMemoryWarning]; | |
| 243 | - // Dispose of any resources that can be recreated. | |
| 244 | -} | |
| 245 | - | |
| 246 | -#pragma mark - IBAction | |
| 247 | -- (IBAction)menuButtonTouchUpInside:(id)sender | |
| 248 | -{ | |
| 249 | - | |
| 250 | -} | |
| 251 | - | |
| 252 | -- (IBAction)todayButtonTouchUpInside:(id)sender | |
| 253 | -{ | |
| 254 | - TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; | |
| 255 | - todayVC.targetStep = targetStep; | |
| 256 | - [self.navigationController pushViewController:todayVC animated:YES]; | |
| 257 | -} | |
| 258 | - | |
| 259 | -- (IBAction)leftButtonTouchUpInside:(id)sender | |
| 260 | -{ | |
| 261 | - self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; | |
| 262 | - self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 263 | - [self resetStepUI]; | |
| 264 | - [self saveStepForDay:self.dateCurrent]; | |
| 265 | - [self requestNotice]; | |
| 266 | -} | |
| 267 | - | |
| 268 | -- (IBAction)rightButtonTouchUpInside:(id)sender | |
| 269 | -{ | |
| 270 | - self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; | |
| 271 | - self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 272 | - [self resetStepUI]; | |
| 273 | - //[self saveStepForDay:self.dateCurrent]; | |
| 274 | - [self requestTopByDate:self.dateCurrent]; | |
| 275 | - [self requestNotice]; | |
| 276 | -} | |
| 277 | - | |
| 278 | -- (IBAction)segmentValueChange:(id)sender { | |
| 279 | - [self resetStepUI]; | |
| 280 | - [self requestTopByDate:self.dateCurrent]; | |
| 281 | -} | |
| 282 | - | |
| 283 | -#pragma mark - Functions Private | |
| 284 | -- (void)saveStepForDay:(NSDate *)date | |
| 285 | -{ | |
| 286 | - if ([CMMotionActivityManager isActivityAvailable] == YES) { | |
| 287 | - [progressHud showAnimated:YES]; | |
| 288 | - [progressHud setHidden:NO]; | |
| 289 | - self.bike = 0; | |
| 290 | - self.walking = 0; | |
| 291 | - self.running = 0; | |
| 292 | - NSDate *startDate = [date beginningAtMidnightOfDay]; | |
| 293 | - NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | |
| 294 | - | |
| 295 | - HomeViewController __weak *weakSelf = self; | |
| 296 | - dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.forDay", NULL); | |
| 297 | - dispatch_async(myQueue, ^{ | |
| 298 | - if (weakSelf == nil) { | |
| 299 | - return ; | |
| 300 | - } | |
| 301 | - | |
| 302 | - [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | |
| 303 | - if (error || activities.count <= 0) { | |
| 304 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 305 | - [weakSelf updateStepUI]; | |
| 306 | - }); | |
| 307 | - return ; | |
| 308 | - } | |
| 309 | - // set EndDate | |
| 310 | - NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | |
| 311 | - for (int i = 0; i < activities.count; i++) { | |
| 312 | - CMMotionActivity *activity = [activities objectAtIndex:i]; | |
| 313 | - CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | |
| 314 | - activityExtra.activity = activity; | |
| 315 | - if (i == activities.count - 1) { | |
| 316 | - activityExtra.endDate = endDate; | |
| 317 | - } | |
| 318 | - else { | |
| 319 | - CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | |
| 320 | - // activityExtra.endDate = [activityNext.startDate dateByAddingTimeInterval:-1]; | |
| 321 | - activityExtra.endDate = activityNext.startDate; | |
| 322 | - } | |
| 323 | - [arrayActivities addObject:activityExtra]; | |
| 324 | - } | |
| 325 | - // PhongNV | |
| 326 | - weakSelf.currentIndex = 0; | |
| 327 | - [weakSelf save20objectOfActivityExtras:arrayActivities]; | |
| 328 | - }]; | |
| 329 | - }); | |
| 330 | - } | |
| 331 | - else { | |
| 332 | - [self updateStepUI]; | |
| 333 | - } | |
| 334 | -} | |
| 335 | - | |
| 336 | -- (void)complete20Request:(NSArray *)activities { | |
| 337 | - if (self.totalRequest == self.countComplete) { | |
| 338 | - self.totalRequest = 0; | |
| 339 | - self.countComplete = 0; | |
| 340 | - self.currentIndex++; | |
| 341 | - [self save20objectOfActivityExtras:activities]; | |
| 342 | - } | |
| 343 | -} | |
| 344 | -- (void)save20objectOfActivityExtras:(NSArray *)activities | |
| 345 | -{ | |
| 346 | - int result = floor(activities.count / maxRequest); | |
| 347 | - if (activities.count <= 0 || self.currentIndex > result) { | |
| 348 | - self.totalRequest = 0; | |
| 349 | - self.countComplete = 0; | |
| 350 | - self.currentIndex = 0; | |
| 351 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
| 352 | - [self updateStepUI]; | |
| 353 | - }); | |
| 354 | - return; | |
| 355 | - } | |
| 356 | - | |
| 357 | - HomeViewController __weak *weakSelf = self; | |
| 358 | - for (NSInteger index = self.currentIndex*maxRequest; index < self.currentIndex*maxRequest + maxRequest; index++) { | |
| 359 | - if ((self.currentIndex*maxRequest + maxRequest) >= activities.count) { | |
| 360 | - self.totalRequest = (int)(activities.count - self.currentIndex*maxRequest); | |
| 361 | - if (self.totalRequest <= 0) { | |
| 362 | - [weakSelf complete20Request:activities]; | |
| 363 | - } | |
| 364 | - } | |
| 365 | - else { | |
| 366 | - self.totalRequest = (int)maxRequest; | |
| 367 | - } | |
| 368 | - if (index < activities.count) { | |
| 369 | - CMMotionActivityExtra *activityExtra = [activities objectAtIndex:index]; | |
| 370 | - [self.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | |
| 371 | - if (weakSelf == nil) { | |
| 372 | - return ; | |
| 373 | - } | |
| 374 | - NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | |
| 375 | - int mode = 1; | |
| 376 | - if (activityExtra.activity.cycling) { | |
| 377 | - mode = 3; | |
| 378 | - } | |
| 379 | - else if (activityExtra.activity.walking) { | |
| 380 | - mode = 1; | |
| 381 | - } | |
| 382 | - else if (activityExtra.activity.running) { | |
| 383 | - mode = 2; | |
| 384 | - } | |
| 385 | - else { | |
| 386 | - // unknown | |
| 387 | - } | |
| 388 | - // save step to server | |
| 389 | - if (numberStep > 0) { | |
| 390 | - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 391 | - [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
| 392 | - NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | |
| 393 | - NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | |
| 394 | - // NSLog(@"dateBegin: %@ | dateEnd: %@ | numberStep: %li", dateBegin, dateEnd, numberStep); | |
| 395 | - [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | |
| 396 | - if (error) { | |
| 397 | - NSLog(@"Error: %@", error); | |
| 398 | - } | |
| 399 | - weakSelf.countComplete++; | |
| 400 | - [weakSelf complete20Request:activities]; | |
| 401 | - }]; | |
| 402 | - } | |
| 403 | - else { | |
| 404 | - weakSelf.countComplete++; | |
| 405 | - [weakSelf complete20Request:activities]; | |
| 406 | - } | |
| 407 | - }]; | |
| 408 | - } | |
| 409 | - } | |
| 410 | -} | |
| 411 | - | |
| 412 | -- (void)updateStepUI | |
| 413 | -{ | |
| 414 | - [self requestTopByDate:self.dateCurrent]; | |
| 415 | -} | |
| 416 | - | |
| 417 | -- (void)saveDataStep7LastDay | |
| 418 | -{ | |
| 419 | - NSDate *dateNow = [NSDate date]; | |
| 420 | - for (int index = 0; index < 7; index++) { | |
| 421 | - dateNow = [dateNow dateByAddingTimeInterval:-(24*60*60)]; | |
| 422 | - [self saveStepByDate:dateNow]; | |
| 423 | - } | |
| 424 | -} | |
| 425 | - | |
| 426 | -- (void)saveStepByDate:(NSDate *)date | |
| 427 | -{ | |
| 428 | - if ([CMMotionActivityManager isActivityAvailable]) { | |
| 429 | - NSDate *startDate = [date beginningAtMidnightOfDay]; | |
| 430 | - NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | |
| 431 | - | |
| 432 | - HomeViewController __weak *weakSelf = self; | |
| 433 | - dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.7lastday", NULL); | |
| 434 | - dispatch_async(myQueue, ^{ | |
| 435 | - if (weakSelf == nil) { | |
| 436 | - return ; | |
| 437 | - } | |
| 438 | - | |
| 439 | - [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | |
| 440 | - if (error || activities.count <= 0) { | |
| 441 | - return ; | |
| 442 | - } | |
| 443 | - // set EndDate | |
| 444 | - NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | |
| 445 | - for (int i = 0; i < activities.count; i++) { | |
| 446 | - CMMotionActivity *activity = [activities objectAtIndex:i]; | |
| 447 | - CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | |
| 448 | - activityExtra.activity = activity; | |
| 449 | - if (i == activities.count - 1) { | |
| 450 | - activityExtra.endDate = endDate; | |
| 451 | - } | |
| 452 | - else { | |
| 453 | - CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | |
| 454 | - activityExtra.endDate = [activityNext.startDate dateByAddingTimeInterval:-1]; | |
| 455 | - } | |
| 456 | - [arrayActivities addObject:activityExtra]; | |
| 457 | - } | |
| 458 | - | |
| 459 | - for (CMMotionActivityExtra *activityExtra in arrayActivities) { | |
| 460 | - [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | |
| 461 | - NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | |
| 462 | - int mode = 1; | |
| 463 | - if (activityExtra.activity.cycling) { | |
| 464 | - mode = 3; | |
| 465 | - } | |
| 466 | - else if (activityExtra.activity.walking) { | |
| 467 | - mode = 1; | |
| 468 | - } | |
| 469 | - else if (activityExtra.activity.running) { | |
| 470 | - mode = 2; | |
| 471 | - } | |
| 472 | - else { | |
| 473 | - // unknown | |
| 474 | - } | |
| 475 | - | |
| 476 | - // save step to server | |
| 477 | - if (numberStep > 0) { | |
| 478 | - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 479 | - [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
| 480 | - NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | |
| 481 | - NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | |
| 482 | - [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | |
| 483 | - if (error) { | |
| 484 | - NSLog(@"Error: %@", error); | |
| 485 | - } | |
| 486 | - }]; | |
| 487 | - } | |
| 488 | - }]; | |
| 489 | - } | |
| 490 | - }]; | |
| 491 | - }); | |
| 492 | - } | |
| 493 | -} | |
| 494 | - | |
| 495 | -- (void)updateStepUI:(TargetInfor *)targetInfor | |
| 496 | -{ | |
| 497 | - NSString *stringTargetStep = [targetInfor.target_step stringByReplacingOccurrencesOfString:@"," withString:@""]; | |
| 498 | - targetStep = [stringTargetStep integerValue]; | |
| 499 | - self.lblValueStep.text = targetInfor.num_step; | |
| 500 | - self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"lifelog.today.remaining.other", nil), targetInfor.remaining_step]; | |
| 501 | - self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), [targetInfor.complete_percent intValue], NSLocalizedString(@"lifelog.today.percent", nil)]; | |
| 502 | -} | |
| 503 | - | |
| 504 | -- (void)updateNoticeUI:(HomeObject *)homeObject | |
| 505 | -{ | |
| 506 | - NSString *stringNotice = @""; | |
| 507 | - for (NoticeInfor *notice in homeObject.listNotice) { | |
| 508 | - NSString *noticeString = [NSString stringWithFormat:@"%@\n", notice.notice_content]; | |
| 509 | - stringNotice = [stringNotice stringByAppendingString:noticeString]; | |
| 510 | - } | |
| 511 | - _tvNotice.text = stringNotice; | |
| 512 | -} | |
| 513 | - | |
| 514 | -- (void)resetStepUI | |
| 515 | -{ | |
| 516 | - self.lblValueStep.text = @""; | |
| 517 | - self.lblValueStepOther.text = @""; | |
| 518 | - self.lblPercent.text = @""; | |
| 519 | -} | |
| 520 | - | |
| 521 | -@end |
LifeLog/LifeLog/HomeViewController.m
| 1 | +// | |
| 2 | +// HomeViewController.m | |
| 3 | +// LifeLog | |
| 4 | +// | |
| 5 | +// Created by Nguyen Van Phong on 7/25/17. | |
| 6 | +// Copyright ยฉ 2017 PhongNV. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "HomeViewController.h" | |
| 10 | +#import "NSDate+helper.h" | |
| 11 | +#import <CoreMotion/CoreMotion.h> | |
| 12 | +#import "CMMotionActivityExtra.h" | |
| 13 | +#import "TodayViewController.h" | |
| 14 | +#import "Utilities.h" | |
| 15 | +#import <MBProgressHUD/MBProgressHUD.h> | |
| 16 | +#import "ServerAPI.h" | |
| 17 | + | |
| 18 | +static NSInteger maxRequest = 20; | |
| 19 | +static NSInteger numberTotal = 10000; | |
| 20 | + | |
| 21 | +@interface HomeViewController () | |
| 22 | +{ | |
| 23 | + MBProgressHUD *progressHud; | |
| 24 | + NSInteger targetStep; | |
| 25 | +} | |
| 26 | +@property (nonatomic, weak) IBOutlet UILabel *lblTitle; | |
| 27 | +@property (nonatomic, weak) IBOutlet UIImageView *avatar; | |
| 28 | +@property (nonatomic, weak) IBOutlet UILabel *lblDateCurrent; | |
| 29 | +@property (nonatomic, weak) IBOutlet UILabel *lblValueStep; | |
| 30 | +@property (nonatomic, weak) IBOutlet UILabel *lblUnitStep; | |
| 31 | +@property (nonatomic, weak) IBOutlet UILabel *lblValueStepOther; | |
| 32 | +@property (nonatomic, weak) IBOutlet UILabel *lblPercent; | |
| 33 | +@property (nonatomic, weak) IBOutlet UILabel *lblNotice; | |
| 34 | +@property (weak, nonatomic) IBOutlet UISegmentedControl *segmentHome; | |
| 35 | +@property (weak, nonatomic) IBOutlet UITextView *tvNotice; | |
| 36 | + | |
| 37 | +@property (nonatomic, strong) CMPedometer *pedometer; | |
| 38 | +@property (nonatomic, strong) CMMotionActivityManager *motionActivityManager; | |
| 39 | +@property (nonatomic, strong) NSOperationQueue *operationQueue; | |
| 40 | +@property (nonatomic, strong) NSTimer *timer; | |
| 41 | +@property (nonatomic, assign) NSInteger bike; | |
| 42 | +@property (nonatomic, assign) NSInteger walking; | |
| 43 | +@property (nonatomic, assign) NSInteger running; | |
| 44 | +@property (nonatomic, strong) NSDate *dateCurrent; | |
| 45 | + | |
| 46 | +@property (nonatomic, assign) int totalRequest; | |
| 47 | +@property (nonatomic, assign) int countComplete; | |
| 48 | +@property (nonatomic, assign) int currentIndex; | |
| 49 | + | |
| 50 | +@end | |
| 51 | + | |
| 52 | +@implementation HomeViewController | |
| 53 | + | |
| 54 | +- (void)viewDidLoad { | |
| 55 | + [super viewDidLoad]; | |
| 56 | + | |
| 57 | + self.lblTitle.text = NSLocalizedString(@"lifelog.home.title", nil); | |
| 58 | + | |
| 59 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.lblTitle attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 60 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.segmentHome attribute:NSLayoutAttributeBottom multiplier:1 constant:20]]; | |
| 61 | + | |
| 62 | + self.avatar.backgroundColor = [UIColor whiteColor]; | |
| 63 | + self.avatar.layer.borderWidth = 2.0f; | |
| 64 | + self.avatar.layer.borderColor = [[UIColor whiteColor] CGColor]; | |
| 65 | + self.avatar.layer.cornerRadius = self.avatar.frame.size.width/2.0f; | |
| 66 | + self.avatar.layer.masksToBounds = YES; | |
| 67 | + NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:kUser]; | |
| 68 | + User *user = (User *)[NSKeyedUnarchiver unarchiveObjectWithData:data]; | |
| 69 | + if (user != nil) { | |
| 70 | + NSString *linkImage = [NSString stringWithFormat:@"%@%@", kServerAddress, user.profile_image]; | |
| 71 | + NSURL *urlImage = [NSURL URLWithString:linkImage]; | |
| 72 | + NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
| 73 | + sessionConfig.timeoutIntervalForRequest = 30.0; | |
| 74 | + sessionConfig.timeoutIntervalForResource = 60.0; | |
| 75 | + sessionConfig.HTTPMaximumConnectionsPerHost = 20; | |
| 76 | + sessionConfig.allowsCellularAccess = YES; | |
| 77 | + HomeViewController __weak *weakSelf = self; | |
| 78 | + NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig]; | |
| 79 | + NSURLSessionDataTask *downloadPhotoTask = [session | |
| 80 | + dataTaskWithURL:urlImage completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
| 81 | + if (weakSelf == nil) | |
| 82 | + { | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + if (error == nil) { | |
| 86 | + UIImage *image = [[UIImage alloc] initWithData:data]; | |
| 87 | + [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | |
| 88 | + weakSelf.avatar.image = image; | |
| 89 | + }]; | |
| 90 | + } | |
| 91 | + }]; | |
| 92 | + [downloadPhotoTask resume]; | |
| 93 | + } | |
| 94 | + | |
| 95 | + self.lblNotice.text = NSLocalizedString(@"lifelog.home.notice", nil); | |
| 96 | + | |
| 97 | + _dateCurrent = [NSDate date]; | |
| 98 | + self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 99 | + | |
| 100 | + self.lblUnitStep.text = NSLocalizedString(@"lifelog.home.unit.step", nil); | |
| 101 | + | |
| 102 | + if ([CMPedometer isStepCountingAvailable]) { | |
| 103 | + _pedometer = [[CMPedometer alloc] init]; | |
| 104 | + } | |
| 105 | + if ([CMMotionActivityManager isActivityAvailable]) { | |
| 106 | + _motionActivityManager = [[CMMotionActivityManager alloc] init]; | |
| 107 | + } | |
| 108 | + _operationQueue = [[NSOperationQueue alloc] init]; | |
| 109 | + _bike = 0; | |
| 110 | + _walking = 0; | |
| 111 | + _running = 0; | |
| 112 | + _segmentHome.selectedSegmentIndex = 1; | |
| 113 | + _totalRequest = 0; | |
| 114 | + _countComplete = 0; | |
| 115 | + | |
| 116 | + progressHud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; | |
| 117 | + progressHud.mode = MBProgressHUDModeIndeterminate; | |
| 118 | + progressHud.detailsLabel.text = NSLocalizedString(@"lifelog.home.progressHud.title", nil); | |
| 119 | + // [self saveDataStep7LastDay]; | |
| 120 | + targetStep = numberTotal; | |
| 121 | + [self requestNotice]; | |
| 122 | +} | |
| 123 | + | |
| 124 | +- (void)requestNotice | |
| 125 | +{ | |
| 126 | + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 127 | + [dateFormatter setDateFormat:@"yyyy-MM-dd"]; | |
| 128 | + NSString *dateString = [dateFormatter stringFromDate:_dateCurrent]; | |
| 129 | + HomeViewController __weak *weakSelf = self; | |
| 130 | + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
| 131 | + //Do background work | |
| 132 | + [[ServerAPI server] getNoticeByDate:dateString CompletionHandler:^(NSArray *arrResults, NSError *error) { | |
| 133 | + if(weakSelf == nil) { | |
| 134 | + return ; | |
| 135 | + } | |
| 136 | + if (error == nil) { | |
| 137 | + // NSLog(@"List Notices: %@", arrResults); | |
| 138 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 139 | + NSString *stringNotice = @""; | |
| 140 | + for (NSString *noticeInfor in arrResults) { | |
| 141 | + NSString *noticeString = [NSString stringWithFormat:@"%@\n", noticeInfor]; | |
| 142 | + stringNotice = [stringNotice stringByAppendingString:noticeString]; | |
| 143 | + } | |
| 144 | + weakSelf.tvNotice.text = stringNotice; | |
| 145 | + }); | |
| 146 | + } | |
| 147 | + else { | |
| 148 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 149 | + weakSelf.tvNotice.text = @""; | |
| 150 | + /* | |
| 151 | + NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 152 | + [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 153 | + */ | |
| 154 | + }); | |
| 155 | + } | |
| 156 | + }]; | |
| 157 | + }); | |
| 158 | +} | |
| 159 | + | |
| 160 | +- (void)viewWillAppear:(BOOL)animated { | |
| 161 | + [super viewWillAppear:animated]; | |
| 162 | + NSDate *dateNow = [NSDate date]; | |
| 163 | + [self saveStepForDay:dateNow]; | |
| 164 | +} | |
| 165 | + | |
| 166 | +- (void)requestTopByDate:(NSDate *)date { | |
| 167 | + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 168 | + [dateFormatter setDateFormat:@"yyyy-MM-dd"]; | |
| 169 | + NSString *dateString = [dateFormatter stringFromDate:date]; | |
| 170 | + [progressHud showAnimated:YES]; | |
| 171 | + [progressHud setHidden:NO]; | |
| 172 | + HomeViewController __weak *weakSelf = self; | |
| 173 | + int mode = 1; | |
| 174 | + switch (_segmentHome.selectedSegmentIndex) { | |
| 175 | + case 0: | |
| 176 | + mode = 3; | |
| 177 | + break; | |
| 178 | + | |
| 179 | + case 1: | |
| 180 | + mode = 1; | |
| 181 | + break; | |
| 182 | + | |
| 183 | + case 2: | |
| 184 | + mode = 2; | |
| 185 | + break; | |
| 186 | + | |
| 187 | + default: | |
| 188 | + break; | |
| 189 | + } | |
| 190 | + [[ServerAPI server] requestTopWithMode:mode andDate:dateString CompletionHandler:^(TopObject *topObject, NSError *error) { | |
| 191 | + if(weakSelf == nil) { | |
| 192 | + return ; | |
| 193 | + } | |
| 194 | + if (error == nil) { | |
| 195 | + NSLog(@"TopObject: %@", topObject); | |
| 196 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 197 | + [weakSelf updateStepUI:topObject.targetInfor]; | |
| 198 | + }); | |
| 199 | + } | |
| 200 | + else { | |
| 201 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 202 | + NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 203 | + [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 204 | + }); | |
| 205 | + } | |
| 206 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 207 | + [progressHud setHidden:YES]; | |
| 208 | + }); | |
| 209 | + }]; | |
| 210 | + /* | |
| 211 | + [[ServerAPI server] requestHomeWithMode:mode andDate:dateString CompletionHandler:^(HomeObject *homeObject, NSError *error) { | |
| 212 | + if(weakSelf == nil) { | |
| 213 | + return ; | |
| 214 | + } | |
| 215 | + if (error == nil) { | |
| 216 | + NSLog(@"List Notices: %@", homeObject.listNotice); | |
| 217 | + for (NoticeInfor *noticeInfor in homeObject.listNotice) { | |
| 218 | + NSLog(@"noticeInfor: %@", noticeInfor.notice_content); | |
| 219 | + } | |
| 220 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 221 | + [weakSelf updateNoticeUI:homeObject]; | |
| 222 | + }); | |
| 223 | + } | |
| 224 | + else { | |
| 225 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 226 | + NSString *message = [error.userInfo objectForKey:@"message"]; | |
| 227 | + [Utilities showErrorMessage:message withViewController:weakSelf]; | |
| 228 | + }); | |
| 229 | + } | |
| 230 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 231 | + [progressHud setHidden:YES]; | |
| 232 | + }); | |
| 233 | + }]; | |
| 234 | + */ | |
| 235 | +} | |
| 236 | + | |
| 237 | +- (void)viewWillDisappear:(BOOL)animated { | |
| 238 | + [super viewWillDisappear:animated]; | |
| 239 | +} | |
| 240 | + | |
| 241 | +- (void)didReceiveMemoryWarning { | |
| 242 | + [super didReceiveMemoryWarning]; | |
| 243 | + // Dispose of any resources that can be recreated. | |
| 244 | +} | |
| 245 | + | |
| 246 | +#pragma mark - IBAction | |
| 247 | +- (IBAction)menuButtonTouchUpInside:(id)sender | |
| 248 | +{ | |
| 249 | + | |
| 250 | +} | |
| 251 | + | |
| 252 | +- (IBAction)todayButtonTouchUpInside:(id)sender | |
| 253 | +{ | |
| 254 | + TodayViewController *todayVC = [[TodayViewController alloc] initWithNibName:@"TodayViewController" bundle:nil]; | |
| 255 | + todayVC.targetStep = targetStep; | |
| 256 | + [self.navigationController pushViewController:todayVC animated:YES]; | |
| 257 | +} | |
| 258 | + | |
| 259 | +- (IBAction)leftButtonTouchUpInside:(id)sender | |
| 260 | +{ | |
| 261 | + self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:-(24*60*60)]; | |
| 262 | + self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 263 | + [self resetStepUI]; | |
| 264 | + [self saveStepForDay:self.dateCurrent]; | |
| 265 | + [self requestNotice]; | |
| 266 | +} | |
| 267 | + | |
| 268 | +- (IBAction)rightButtonTouchUpInside:(id)sender | |
| 269 | +{ | |
| 270 | + self.dateCurrent = [self.dateCurrent dateByAddingTimeInterval:24*60*60]; | |
| 271 | + self.lblDateCurrent.text = [NSString stringWithFormat:@"%ld%@%ld%@%ld%@", (long)[_dateCurrent getYear], NSLocalizedString(@"lifelog.common.year", nil), (long)[_dateCurrent getMonth], NSLocalizedString(@"lifelog.common.month", nil), (long)[_dateCurrent getDay], NSLocalizedString(@"lifelog.common.day", nil)]; | |
| 272 | + [self resetStepUI]; | |
| 273 | + //[self saveStepForDay:self.dateCurrent]; | |
| 274 | + [self requestTopByDate:self.dateCurrent]; | |
| 275 | + [self requestNotice]; | |
| 276 | +} | |
| 277 | + | |
| 278 | +- (IBAction)segmentValueChange:(id)sender { | |
| 279 | + [self resetStepUI]; | |
| 280 | + [self requestTopByDate:self.dateCurrent]; | |
| 281 | +} | |
| 282 | + | |
| 283 | +#pragma mark - Functions Private | |
| 284 | +- (void)saveStepForDay:(NSDate *)date | |
| 285 | +{ | |
| 286 | + if ([CMMotionActivityManager isActivityAvailable] == YES) { | |
| 287 | + [progressHud showAnimated:YES]; | |
| 288 | + [progressHud setHidden:NO]; | |
| 289 | + self.bike = 0; | |
| 290 | + self.walking = 0; | |
| 291 | + self.running = 0; | |
| 292 | + NSDate *startDate = [date beginningAtMidnightOfDay]; | |
| 293 | + NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | |
| 294 | + | |
| 295 | + HomeViewController __weak *weakSelf = self; | |
| 296 | + dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.forDay", NULL); | |
| 297 | + dispatch_async(myQueue, ^{ | |
| 298 | + if (weakSelf == nil) { | |
| 299 | + return ; | |
| 300 | + } | |
| 301 | + | |
| 302 | + [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | |
| 303 | + if (error || activities.count <= 0) { | |
| 304 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 305 | + [weakSelf updateStepUI]; | |
| 306 | + }); | |
| 307 | + return ; | |
| 308 | + } | |
| 309 | + // set EndDate | |
| 310 | + NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | |
| 311 | + for (int i = 0; i < activities.count; i++) { | |
| 312 | + CMMotionActivity *activity = [activities objectAtIndex:i]; | |
| 313 | + CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | |
| 314 | + activityExtra.activity = activity; | |
| 315 | + if (i == activities.count - 1) { | |
| 316 | + activityExtra.endDate = endDate; | |
| 317 | + } | |
| 318 | + else { | |
| 319 | + CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | |
| 320 | + // activityExtra.endDate = [activityNext.startDate dateByAddingTimeInterval:-1]; | |
| 321 | + activityExtra.endDate = activityNext.startDate; | |
| 322 | + } | |
| 323 | + [arrayActivities addObject:activityExtra]; | |
| 324 | + } | |
| 325 | + // PhongNV | |
| 326 | + weakSelf.currentIndex = 0; | |
| 327 | + [weakSelf save20objectOfActivityExtras:arrayActivities]; | |
| 328 | + }]; | |
| 329 | + }); | |
| 330 | + } | |
| 331 | + else { | |
| 332 | + [self updateStepUI]; | |
| 333 | + } | |
| 334 | +} | |
| 335 | + | |
| 336 | +- (void)complete20Request:(NSArray *)activities { | |
| 337 | + if (self.totalRequest == self.countComplete) { | |
| 338 | + self.totalRequest = 0; | |
| 339 | + self.countComplete = 0; | |
| 340 | + self.currentIndex++; | |
| 341 | + [self save20objectOfActivityExtras:activities]; | |
| 342 | + } | |
| 343 | +} | |
| 344 | +- (void)save20objectOfActivityExtras:(NSArray *)activities | |
| 345 | +{ | |
| 346 | + int result = floor(activities.count / maxRequest); | |
| 347 | + if (activities.count <= 0 || self.currentIndex > result) { | |
| 348 | + self.totalRequest = 0; | |
| 349 | + self.countComplete = 0; | |
| 350 | + self.currentIndex = 0; | |
| 351 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
| 352 | + [self updateStepUI]; | |
| 353 | + }); | |
| 354 | + return; | |
| 355 | + } | |
| 356 | + | |
| 357 | + HomeViewController __weak *weakSelf = self; | |
| 358 | + for (NSInteger index = self.currentIndex*maxRequest; index < self.currentIndex*maxRequest + maxRequest; index++) { | |
| 359 | + if ((self.currentIndex*maxRequest + maxRequest) >= activities.count) { | |
| 360 | + self.totalRequest = (int)(activities.count - self.currentIndex*maxRequest); | |
| 361 | + if (self.totalRequest <= 0) { | |
| 362 | + [weakSelf complete20Request:activities]; | |
| 363 | + } | |
| 364 | + } | |
| 365 | + else { | |
| 366 | + self.totalRequest = (int)maxRequest; | |
| 367 | + } | |
| 368 | + if (index < activities.count) { | |
| 369 | + CMMotionActivityExtra *activityExtra = [activities objectAtIndex:index]; | |
| 370 | + [self.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | |
| 371 | + if (weakSelf == nil) { | |
| 372 | + return ; | |
| 373 | + } | |
| 374 | + NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | |
| 375 | + int mode = 1; | |
| 376 | + if (activityExtra.activity.cycling) { | |
| 377 | + mode = 3; | |
| 378 | + } | |
| 379 | + else if (activityExtra.activity.walking) { | |
| 380 | + mode = 1; | |
| 381 | + } | |
| 382 | + else if (activityExtra.activity.running) { | |
| 383 | + mode = 2; | |
| 384 | + } | |
| 385 | + else { | |
| 386 | + // unknown | |
| 387 | + } | |
| 388 | + // save step to server | |
| 389 | + if (numberStep > 0) { | |
| 390 | + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 391 | + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
| 392 | + NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | |
| 393 | + NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | |
| 394 | + // NSLog(@"dateBegin: %@ | dateEnd: %@ | numberStep: %li", dateBegin, dateEnd, numberStep); | |
| 395 | + [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | |
| 396 | + if (error) { | |
| 397 | + NSLog(@"Error: %@", error); | |
| 398 | + } | |
| 399 | + weakSelf.countComplete++; | |
| 400 | + [weakSelf complete20Request:activities]; | |
| 401 | + }]; | |
| 402 | + } | |
| 403 | + else { | |
| 404 | + weakSelf.countComplete++; | |
| 405 | + [weakSelf complete20Request:activities]; | |
| 406 | + } | |
| 407 | + }]; | |
| 408 | + } | |
| 409 | + } | |
| 410 | +} | |
| 411 | + | |
| 412 | +- (void)updateStepUI | |
| 413 | +{ | |
| 414 | + [self requestTopByDate:self.dateCurrent]; | |
| 415 | +} | |
| 416 | + | |
| 417 | +- (void)saveDataStep7LastDay | |
| 418 | +{ | |
| 419 | + NSDate *dateNow = [NSDate date]; | |
| 420 | + for (int index = 0; index < 7; index++) { | |
| 421 | + dateNow = [dateNow dateByAddingTimeInterval:-(24*60*60)]; | |
| 422 | + [self saveStepByDate:dateNow]; | |
| 423 | + } | |
| 424 | +} | |
| 425 | + | |
| 426 | +- (void)saveStepByDate:(NSDate *)date | |
| 427 | +{ | |
| 428 | + if ([CMMotionActivityManager isActivityAvailable]) { | |
| 429 | + NSDate *startDate = [date beginningAtMidnightOfDay]; | |
| 430 | + NSDate *endDate = [startDate dateByAddingTimeInterval:(24*60*60 - 1)]; | |
| 431 | + | |
| 432 | + HomeViewController __weak *weakSelf = self; | |
| 433 | + dispatch_queue_t myQueue = dispatch_queue_create("mobileworld.jp.lifelog.7lastday", NULL); | |
| 434 | + dispatch_async(myQueue, ^{ | |
| 435 | + if (weakSelf == nil) { | |
| 436 | + return ; | |
| 437 | + } | |
| 438 | + | |
| 439 | + [weakSelf.motionActivityManager queryActivityStartingFromDate:startDate toDate:endDate toQueue:_operationQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) { | |
| 440 | + if (error || activities.count <= 0) { | |
| 441 | + return ; | |
| 442 | + } | |
| 443 | + // set EndDate | |
| 444 | + NSMutableArray *arrayActivities = [[NSMutableArray alloc] init]; | |
| 445 | + for (int i = 0; i < activities.count; i++) { | |
| 446 | + CMMotionActivity *activity = [activities objectAtIndex:i]; | |
| 447 | + CMMotionActivityExtra *activityExtra = [[CMMotionActivityExtra alloc] init]; | |
| 448 | + activityExtra.activity = activity; | |
| 449 | + if (i == activities.count - 1) { | |
| 450 | + activityExtra.endDate = endDate; | |
| 451 | + } | |
| 452 | + else { | |
| 453 | + CMMotionActivity *activityNext = [activities objectAtIndex:i+1]; | |
| 454 | + activityExtra.endDate = [activityNext.startDate dateByAddingTimeInterval:-1]; | |
| 455 | + } | |
| 456 | + [arrayActivities addObject:activityExtra]; | |
| 457 | + } | |
| 458 | + | |
| 459 | + for (CMMotionActivityExtra *activityExtra in arrayActivities) { | |
| 460 | + [weakSelf.pedometer queryPedometerDataFromDate:activityExtra.activity.startDate toDate:activityExtra.endDate withHandler:^(CMPedometerData * _Nullable pedometerData, NSError * _Nullable error) { | |
| 461 | + NSInteger numberStep = [pedometerData.numberOfSteps integerValue]; | |
| 462 | + int mode = 1; | |
| 463 | + if (activityExtra.activity.cycling) { | |
| 464 | + mode = 3; | |
| 465 | + } | |
| 466 | + else if (activityExtra.activity.walking) { | |
| 467 | + mode = 1; | |
| 468 | + } | |
| 469 | + else if (activityExtra.activity.running) { | |
| 470 | + mode = 2; | |
| 471 | + } | |
| 472 | + else { | |
| 473 | + // unknown | |
| 474 | + } | |
| 475 | + | |
| 476 | + // save step to server | |
| 477 | + if (numberStep > 0) { | |
| 478 | + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| 479 | + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; | |
| 480 | + NSString *dateBegin = [dateFormatter stringFromDate:activityExtra.activity.startDate]; | |
| 481 | + NSString *dateEnd = [dateFormatter stringFromDate:activityExtra.endDate]; | |
| 482 | + [[ServerAPI server] requestCreateLog:mode withStep:(int)numberStep startDate:dateBegin endDate:dateEnd CompletionHandler:^(NSError *error) { | |
| 483 | + if (error) { | |
| 484 | + NSLog(@"Error: %@", error); | |
| 485 | + } | |
| 486 | + }]; | |
| 487 | + } | |
| 488 | + }]; | |
| 489 | + } | |
| 490 | + }]; | |
| 491 | + }); | |
| 492 | + } | |
| 493 | +} | |
| 494 | + | |
| 495 | +- (void)updateStepUI:(TargetInfor *)targetInfor | |
| 496 | +{ | |
| 497 | + NSString *stringTargetStep = [targetInfor.target_step stringByReplacingOccurrencesOfString:@"," withString:@""]; | |
| 498 | + targetStep = [stringTargetStep integerValue]; | |
| 499 | + self.lblValueStep.text = targetInfor.num_step; | |
| 500 | + self.lblValueStepOther.text = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"lifelog.today.remaining.other", nil), targetInfor.remaining_step]; | |
| 501 | + self.lblPercent.text = [NSString stringWithFormat:@"%@ %i%@", NSLocalizedString(@"lifelog.today.text.percent", nil), [targetInfor.complete_percent intValue], NSLocalizedString(@"lifelog.today.percent", nil)]; | |
| 502 | +} | |
| 503 | + | |
| 504 | +- (void)updateNoticeUI:(HomeObject *)homeObject | |
| 505 | +{ | |
| 506 | + NSString *stringNotice = @""; | |
| 507 | + for (NoticeInfor *notice in homeObject.listNotice) { | |
| 508 | + NSString *noticeString = [NSString stringWithFormat:@"%@\n", notice.notice_content]; | |
| 509 | + stringNotice = [stringNotice stringByAppendingString:noticeString]; | |
| 510 | + } | |
| 511 | + _tvNotice.text = stringNotice; | |
| 512 | +} | |
| 513 | + | |
| 514 | +- (void)resetStepUI | |
| 515 | +{ | |
| 516 | + self.lblValueStep.text = @""; | |
| 517 | + self.lblValueStepOther.text = @""; | |
| 518 | + self.lblPercent.text = @""; | |
| 519 | +} | |
| 520 | + | |
| 521 | +@end |
LifeLog/LifeLog/HomeViewController.xib
| ... | ... | @@ -30,9 +30,12 @@ |
| 30 | 30 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
| 31 | 31 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
| 32 | 32 | <subviews> |
| 33 | + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="background" translatesAutoresizingMaskIntoConstraints="NO" id="1z5-6l-aht"> | |
| 34 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
| 35 | + </imageView> | |
| 33 | 36 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="HOME" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u3S-9u-GMZ" userLabel="LabelTitle"> |
| 34 | 37 | <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> |
| 35 | - <color key="backgroundColor" red="0.098039215686274508" green="0.098039215686274508" blue="0.098039215686274508" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 38 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 36 | 39 | <constraints> |
| 37 | 40 | <constraint firstAttribute="height" constant="44" id="8z2-GM-1iE"/> |
| 38 | 41 | </constraints> |
| 39 | 42 | |
| 40 | 43 | |
| 41 | 44 | |
| 42 | 45 | |
| 43 | 46 | |
| ... | ... | @@ -188,30 +191,36 @@ |
| 188 | 191 | <constraint firstAttribute="trailing" secondItem="Low-8n-pqa" secondAttribute="trailing" constant="10" id="0OY-h0-Rgg"/> |
| 189 | 192 | <constraint firstAttribute="trailing" secondItem="kdD-rj-BtX" secondAttribute="trailing" constant="8" id="3bP-sY-1pI"/> |
| 190 | 193 | <constraint firstItem="u3S-9u-GMZ" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="4TN-aJ-vQh"/> |
| 194 | + <constraint firstItem="1z5-6l-aht" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="6F9-oQ-tmg"/> | |
| 191 | 195 | <constraint firstAttribute="trailing" secondItem="u3S-9u-GMZ" secondAttribute="trailing" id="8KH-Mn-IUf"/> |
| 192 | 196 | <constraint firstItem="DuE-Dh-nEe" firstAttribute="top" secondItem="3Xj-IB-96h" secondAttribute="bottom" constant="8" id="9h2-XH-Dd7"/> |
| 193 | 197 | <constraint firstItem="kdD-rj-BtX" firstAttribute="top" secondItem="lnt-4H-Ao8" secondAttribute="bottom" constant="8" id="BCi-jo-C0A"/> |
| 198 | + <constraint firstAttribute="trailing" secondItem="1z5-6l-aht" secondAttribute="trailing" id="CAn-98-y2W"/> | |
| 194 | 199 | <constraint firstAttribute="trailing" secondItem="LPY-Zl-cOp" secondAttribute="trailing" constant="10" id="CX3-BL-hNh"/> |
| 195 | 200 | <constraint firstItem="vRa-cr-YTe" firstAttribute="leading" secondItem="J2A-tf-wH0" secondAttribute="trailing" constant="10" id="Cax-pu-Kp7"/> |
| 196 | 201 | <constraint firstItem="3Xj-IB-96h" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="E8R-qO-PtJ"/> |
| 197 | 202 | <constraint firstItem="b6V-Bi-4oz" firstAttribute="centerX" secondItem="vRa-cr-YTe" secondAttribute="centerX" id="EEt-Ct-vxb"/> |
| 198 | 203 | <constraint firstItem="u3S-9u-GMZ" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" placeholder="YES" id="GbN-me-UEd"/> |
| 204 | + <constraint firstItem="1z5-6l-aht" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Gg0-mA-0AM"/> | |
| 199 | 205 | <constraint firstItem="b6V-Bi-4oz" firstAttribute="centerY" secondItem="vRa-cr-YTe" secondAttribute="centerY" id="HXS-oH-EPB"/> |
| 200 | 206 | <constraint firstItem="vRa-cr-YTe" firstAttribute="centerY" secondItem="J2A-tf-wH0" secondAttribute="centerY" id="IDF-HZ-fqt"/> |
| 201 | 207 | <constraint firstAttribute="trailing" secondItem="lnt-4H-Ao8" secondAttribute="trailing" constant="8" id="IEA-1V-AZx"/> |
| 202 | 208 | <constraint firstItem="ibb-Yl-iqu" firstAttribute="top" secondItem="VAz-hq-dvR" secondAttribute="bottom" constant="20" id="Ib2-KY-3A7"/> |
| 203 | 209 | <constraint firstAttribute="bottom" secondItem="ibb-Yl-iqu" secondAttribute="bottom" constant="64" placeholder="YES" id="Iv8-Al-1Ff"/> |
| 204 | 210 | <constraint firstItem="DuE-Dh-nEe" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="Rum-yc-3Ym"/> |
| 211 | + <constraint firstAttribute="trailing" secondItem="1z5-6l-aht" secondAttribute="trailing" id="Vdm-Es-9gL"/> | |
| 205 | 212 | <constraint firstItem="Low-8n-pqa" firstAttribute="centerY" secondItem="J2A-tf-wH0" secondAttribute="centerY" id="W7b-Hb-9ME"/> |
| 206 | 213 | <constraint firstItem="IaR-IO-4RA" firstAttribute="centerY" secondItem="J2A-tf-wH0" secondAttribute="centerY" id="b4I-Me-4xZ"/> |
| 207 | 214 | <constraint firstItem="wfu-aB-xXm" firstAttribute="top" secondItem="IaR-IO-4RA" secondAttribute="bottom" constant="40" id="bH1-l5-YRA"/> |
| 208 | 215 | <constraint firstItem="lnt-4H-Ao8" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="ea3-Dx-s4s"/> |
| 216 | + <constraint firstItem="1z5-6l-aht" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="h15-0H-1uW"/> | |
| 209 | 217 | <constraint firstItem="at8-co-gC4" firstAttribute="centerX" secondItem="Low-8n-pqa" secondAttribute="centerX" id="h5o-Cj-Z7s"/> |
| 210 | 218 | <constraint firstAttribute="trailing" secondItem="DuE-Dh-nEe" secondAttribute="trailing" constant="8" id="iyi-TY-Wfe"/> |
| 211 | 219 | <constraint firstItem="LPY-Zl-cOp" firstAttribute="centerY" secondItem="u3S-9u-GMZ" secondAttribute="centerY" id="jBf-Ck-YYj"/> |
| 212 | 220 | <constraint firstItem="TUf-Tp-93t" firstAttribute="centerY" secondItem="wfu-aB-xXm" secondAttribute="centerY" constant="-5" id="k3n-lY-8K1"/> |
| 213 | 221 | <constraint firstItem="J2A-tf-wH0" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="mVQ-bZ-JBW"/> |
| 214 | 222 | <constraint firstAttribute="trailing" secondItem="wfu-aB-xXm" secondAttribute="trailing" constant="20" id="mtA-2Q-ssH"/> |
| 223 | + <constraint firstAttribute="bottom" secondItem="1z5-6l-aht" secondAttribute="bottom" id="nJy-I1-hpu"/> | |
| 215 | 224 | <constraint firstItem="ibb-Yl-iqu" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="nOT-Ic-JU1"/> |
| 216 | 225 | <constraint firstItem="J2A-tf-wH0" firstAttribute="top" secondItem="u3S-9u-GMZ" secondAttribute="bottom" constant="10" id="nu9-Lj-5xz"/> |
| 217 | 226 | <constraint firstAttribute="trailing" secondItem="3Xj-IB-96h" secondAttribute="trailing" constant="8" id="pF6-db-UUi"/> |
| 218 | 227 | |
| 219 | 228 | |
| ... | ... | @@ -223,13 +232,16 @@ |
| 223 | 232 | <constraint firstItem="lnt-4H-Ao8" firstAttribute="top" secondItem="DuE-Dh-nEe" secondAttribute="bottom" constant="20" id="w4w-Z4-Jzk"/> |
| 224 | 233 | <constraint firstItem="wfu-aB-xXm" firstAttribute="leading" secondItem="TUf-Tp-93t" secondAttribute="trailing" constant="10" id="x51-DA-4Le"/> |
| 225 | 234 | <constraint firstItem="VAz-hq-dvR" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="xE7-ro-k8m"/> |
| 235 | + <constraint firstAttribute="bottom" secondItem="1z5-6l-aht" secondAttribute="bottom" id="xXu-0F-pzQ"/> | |
| 226 | 236 | <constraint firstItem="Low-8n-pqa" firstAttribute="leading" secondItem="IaR-IO-4RA" secondAttribute="trailing" constant="8" id="y6e-6A-hjn"/> |
| 237 | + <constraint firstItem="1z5-6l-aht" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="yK2-RH-eNB"/> | |
| 227 | 238 | </constraints> |
| 228 | 239 | <point key="canvasLocation" x="33.5" y="97.5"/> |
| 229 | 240 | </view> |
| 230 | 241 | </objects> |
| 231 | 242 | <resources> |
| 232 | - <image name="avatar_default" width="80" height="80"/> | |
| 243 | + <image name="avatar_default" width="127" height="136"/> | |
| 244 | + <image name="background" width="1563" height="2778"/> | |
| 233 | 245 | <image name="icon_left" width="30" height="30"/> |
| 234 | 246 | <image name="icon_menu" width="30" height="30"/> |
| 235 | 247 | <image name="icon_right" width="30" height="30"/> |
LifeLog/LifeLog/LabelCollectionViewCell.h
LifeLog/LifeLog/LabelCollectionViewCell.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 9 | 10 | </dependencies> |
| 10 | 11 | <objects> |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | |
| ... | ... | @@ -24,17 +25,26 @@ |
| 24 | 25 | <nil key="textColor"/> |
| 25 | 26 | <nil key="highlightedColor"/> |
| 26 | 27 | </label> |
| 28 | + <imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ls0-bk-ldb"> | |
| 29 | + <rect key="frame" x="0.0" y="0.0" width="246" height="175"/> | |
| 30 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 31 | + </imageView> | |
| 27 | 32 | </subviews> |
| 28 | 33 | </view> |
| 29 | 34 | <constraints> |
| 35 | + <constraint firstAttribute="trailing" secondItem="ls0-bk-ldb" secondAttribute="trailing" id="Cfz-rI-IEI"/> | |
| 30 | 36 | <constraint firstItem="R7x-TO-3nQ" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="FsP-if-zJU"/> |
| 31 | 37 | <constraint firstAttribute="trailing" secondItem="R7x-TO-3nQ" secondAttribute="trailing" id="RXy-Ax-f7c"/> |
| 38 | + <constraint firstItem="ls0-bk-ldb" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Ysx-ug-OWw"/> | |
| 32 | 39 | <constraint firstAttribute="bottom" secondItem="R7x-TO-3nQ" secondAttribute="bottom" id="bir-WN-giG"/> |
| 40 | + <constraint firstAttribute="bottom" secondItem="ls0-bk-ldb" secondAttribute="bottom" id="jPv-Kj-zFK"/> | |
| 33 | 41 | <constraint firstItem="R7x-TO-3nQ" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="nEO-eg-OOM"/> |
| 42 | + <constraint firstItem="ls0-bk-ldb" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="nqo-ds-9ou"/> | |
| 34 | 43 | </constraints> |
| 35 | 44 | <size key="customSize" width="246" height="175"/> |
| 36 | 45 | <connections> |
| 37 | - <outlet property="lblTitle" destination="R7x-TO-3nQ" id="Iuz-tJ-aWb"/> | |
| 46 | + <outlet property="imgIcon" destination="ls0-bk-ldb" id="pLg-1p-9sI"/> | |
| 47 | + <outlet property="lblTitle" destination="R7x-TO-3nQ" id="YkO-eX-8rQ"/> | |
| 38 | 48 | </connections> |
| 39 | 49 | <point key="canvasLocation" x="123" y="114.5"/> |
| 40 | 50 | </collectionViewCell> |
LifeLog/LifeLog/MapViewController.m
| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | - (void)viewDidLoad { |
| 43 | 43 | [super viewDidLoad]; |
| 44 | 44 | // Do any additional setup after loading the view from its nib. |
| 45 | - self.title = NSLocalizedString(@"lifelog.tapbar.map", nil); | |
| 45 | +// self.title = NSLocalizedString(@"lifelog.tapbar.map", nil); | |
| 46 | 46 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.mapView attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; |
| 47 | 47 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.mapView attribute:NSLayoutAttributeBottom multiplier:1 constant:44]]; |
| 48 | 48 | geocoder = [[CLGeocoder alloc] init]; |
LifeLog/LifeLog/MyGroupViewController.h
| ... | ... | @@ -14,6 +14,7 @@ |
| 14 | 14 | @interface MyGroupViewController : GroupDetailViewController { |
| 15 | 15 | NSMutableArray *_curListGrp; |
| 16 | 16 | } |
| 17 | +@property (weak, nonatomic) IBOutlet UIView *viewHeader; | |
| 17 | 18 | |
| 18 | 19 | @property (weak, nonatomic) IBOutlet UITableView *tableGrp; |
| 19 | 20 | @property (weak, nonatomic) IBOutlet UIButton *btShowGrp; |
LifeLog/LifeLog/MyGroupViewController.m
| ... | ... | @@ -20,6 +20,8 @@ |
| 20 | 20 | |
| 21 | 21 | - (void)viewDidLoad { |
| 22 | 22 | [super viewDidLoad]; |
| 23 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 24 | + | |
| 23 | 25 | isMemberList = false; |
| 24 | 26 | _curListGrp = [[NSMutableArray alloc] init]; |
| 25 | 27 | [self.tableBase registerNib:[UINib nibWithNibName:@"SNSRecentTopicTableViewCell" bundle:nil] forCellReuseIdentifier:@"RecentTopicCell"]; |
LifeLog/LifeLog/MyGroupViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 9 | 10 | </dependencies> |
| 10 | 11 | <objects> |
| ... | ... | @@ -18,6 +19,7 @@ |
| 18 | 19 | <outlet property="tableBase" destination="ubS-v9-zCa" id="gea-9H-gpI"/> |
| 19 | 20 | <outlet property="tableGrp" destination="dtD-J5-dze" id="ahq-Cd-85X"/> |
| 20 | 21 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| 22 | + <outlet property="viewHeader" destination="vxT-xe-7mV" id="Vdh-R8-aiJ"/> | |
| 21 | 23 | </connections> |
| 22 | 24 | </placeholder> |
| 23 | 25 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -55,7 +57,7 @@ |
| 55 | 57 | <state key="normal" image="icon_menu"/> |
| 56 | 58 | </button> |
| 57 | 59 | </subviews> |
| 58 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 60 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 59 | 61 | <constraints> |
| 60 | 62 | <constraint firstAttribute="trailing" secondItem="7gh-nf-sKZ" secondAttribute="trailing" id="2JD-YU-WS2"/> |
| 61 | 63 | <constraint firstItem="Txe-1I-61m" firstAttribute="leading" secondItem="vxT-xe-7mV" secondAttribute="leading" id="30c-J3-6ba"/> |
| 62 | 64 | |
| ... | ... | @@ -206,10 +208,10 @@ |
| 206 | 208 | </connections> |
| 207 | 209 | </tableView> |
| 208 | 210 | </subviews> |
| 209 | - <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
| 211 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 210 | 212 | <constraints> |
| 211 | 213 | <constraint firstItem="ftA-wa-19F" firstAttribute="top" secondItem="SNe-1B-nwV" secondAttribute="bottom" constant="8" id="4iN-BW-Eaa"/> |
| 212 | - <constraint firstItem="vxT-xe-7mV" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5np-jI-7iK"/> | |
| 214 | + <constraint firstItem="vxT-xe-7mV" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="5np-jI-7iK"/> | |
| 213 | 215 | <constraint firstAttribute="trailing" secondItem="eBu-7L-nsx" secondAttribute="trailing" constant="15" id="AkN-Cv-ULu"/> |
| 214 | 216 | <constraint firstItem="SNe-1B-nwV" firstAttribute="top" secondItem="hhh-nO-yn5" secondAttribute="bottom" constant="15" id="BL0-Cv-jlz"/> |
| 215 | 217 | <constraint firstItem="ubS-v9-zCa" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Dt8-xl-lI8"/> |
LifeLog/LifeLog/RankingTableViewCell.h
| ... | ... | @@ -10,12 +10,12 @@ |
| 10 | 10 | #import "RankingObject.h" |
| 11 | 11 | |
| 12 | 12 | @interface RankingTableViewCell : UITableViewCell |
| 13 | -@property (weak, nonatomic) IBOutlet UILabel *lblIndex; | |
| 14 | 13 | @property (weak, nonatomic) IBOutlet UILabel *lblName; |
| 15 | 14 | @property (weak, nonatomic) IBOutlet UILabel *lblStep; |
| 16 | 15 | @property (weak, nonatomic) IBOutlet UILabel *lblTime; |
| 17 | 16 | @property (weak, nonatomic) IBOutlet UILabel *lblDistance; |
| 18 | 17 | |
| 18 | +@property (weak, nonatomic) IBOutlet UIImageView *imgRank; | |
| 19 | 19 | @property (weak, nonatomic) IBOutlet UIImageView *imgAvatar; |
| 20 | 20 | |
| 21 | 21 | -(void) setRankingData : (RankingObject *) object; |
LifeLog/LifeLog/RankingTableViewCell.m
| ... | ... | @@ -30,7 +30,6 @@ |
| 30 | 30 | else { |
| 31 | 31 | [self.imgAvatar setImage:[UIImage imageNamed:@"avatar_default"]]; |
| 32 | 32 | } |
| 33 | - self.lblIndex.text = [NSString stringWithFormat:@"%d", object.rank]; | |
| 34 | 33 | self.lblName.text = object.userName; |
| 35 | 34 | self.lblDistance.text = [NSString stringWithFormat:@"%0.1f km", object.distance]; |
| 36 | 35 | self.lblStep.text = [NSString stringWithFormat:@"%d ๆญฉ", object.steps]; |
LifeLog/LifeLog/RankingTableViewCell.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="Constraints to layout margins" minToolsVersion="6.0"/> |
| 9 | 10 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 10 | 11 | </dependencies> |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | |
| ... | ... | @@ -18,24 +19,21 @@ |
| 18 | 19 | <rect key="frame" x="0.0" y="0.0" width="320" height="79.5"/> |
| 19 | 20 | <autoresizingMask key="autoresizingMask"/> |
| 20 | 21 | <subviews> |
| 21 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="8qq-of-Fwv"> | |
| 22 | - <rect key="frame" x="0.0" y="0.0" width="40" height="80"/> | |
| 23 | - <constraints> | |
| 24 | - <constraint firstAttribute="width" constant="40" id="9dX-af-kQI"/> | |
| 25 | - </constraints> | |
| 26 | - <fontDescription key="fontDescription" type="system" pointSize="20"/> | |
| 27 | - <nil key="textColor"/> | |
| 28 | - <nil key="highlightedColor"/> | |
| 29 | - </label> | |
| 30 | 22 | <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar_default" translatesAutoresizingMaskIntoConstraints="NO" id="1CW-Zi-SG6"> |
| 31 | - <rect key="frame" x="48" y="15" width="50" height="50"/> | |
| 23 | + <rect key="frame" x="63" y="15" width="50" height="50"/> | |
| 24 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 32 | 25 | <constraints> |
| 33 | 26 | <constraint firstAttribute="width" constant="50" id="1kJ-7c-3b3"/> |
| 34 | 27 | <constraint firstAttribute="height" constant="50" id="LNu-c6-CgW"/> |
| 35 | 28 | </constraints> |
| 29 | + <userDefinedRuntimeAttributes> | |
| 30 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> | |
| 31 | + <integer key="value" value="5"/> | |
| 32 | + </userDefinedRuntimeAttribute> | |
| 33 | + </userDefinedRuntimeAttributes> | |
| 36 | 34 | </imageView> |
| 37 | 35 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ใฆใผใถใผใใใใฏใใผใ " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zAG-NS-RSG"> |
| 38 | - <rect key="frame" x="106" y="8" width="206" height="15"/> | |
| 36 | + <rect key="frame" x="121" y="11" width="183" height="15"/> | |
| 39 | 37 | <constraints> |
| 40 | 38 | <constraint firstAttribute="height" constant="15" id="RjF-Lj-HNO"/> |
| 41 | 39 | </constraints> |
| ... | ... | @@ -44,7 +42,7 @@ |
| 44 | 42 | <nil key="highlightedColor"/> |
| 45 | 43 | </label> |
| 46 | 44 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LgT-0e-lsD"> |
| 47 | - <rect key="frame" x="106" y="31" width="78" height="15"/> | |
| 45 | + <rect key="frame" x="121" y="34" width="64" height="15"/> | |
| 48 | 46 | <constraints> |
| 49 | 47 | <constraint firstAttribute="height" constant="15" id="WXg-qM-mCv"/> |
| 50 | 48 | </constraints> |
| ... | ... | @@ -56,7 +54,7 @@ |
| 56 | 54 | <nil key="highlightedColor"/> |
| 57 | 55 | </label> |
| 58 | 56 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yeV-e1-xLt"> |
| 59 | - <rect key="frame" x="194" y="28" width="78" height="15"/> | |
| 57 | + <rect key="frame" x="241" y="31" width="64" height="15"/> | |
| 60 | 58 | <constraints> |
| 61 | 59 | <constraint firstAttribute="height" constant="15" id="8uP-Oz-0UX"/> |
| 62 | 60 | </constraints> |
| 63 | 61 | |
| 64 | 62 | |
| 65 | 63 | |
| ... | ... | @@ -67,22 +65,15 @@ |
| 67 | 65 | <nil key="textColor"/> |
| 68 | 66 | <nil key="highlightedColor"/> |
| 69 | 67 | </label> |
| 70 | - <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="tapbar_today" translatesAutoresizingMaskIntoConstraints="NO" id="doD-2D-mUh"> | |
| 71 | - <rect key="frame" x="280" y="28" width="25" height="25"/> | |
| 72 | - <constraints> | |
| 73 | - <constraint firstAttribute="height" constant="25" id="m7H-Vi-MjX"/> | |
| 74 | - <constraint firstAttribute="width" constant="25" id="yJJ-70-k1M"/> | |
| 75 | - </constraints> | |
| 76 | - </imageView> | |
| 77 | 68 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="A45-dY-zJ7"> |
| 78 | - <rect key="frame" x="0.0" y="78" width="320" height="2"/> | |
| 79 | - <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> | |
| 69 | + <rect key="frame" x="0.0" y="79" width="320" height="1"/> | |
| 70 | + <color key="backgroundColor" white="1" alpha="0.5" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 80 | 71 | <constraints> |
| 81 | - <constraint firstAttribute="height" constant="2" id="RXE-vE-Bye"/> | |
| 72 | + <constraint firstAttribute="height" constant="0.5" id="RXE-vE-Bye"/> | |
| 82 | 73 | </constraints> |
| 83 | 74 | </view> |
| 84 | 75 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11:22:33" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="esv-WJ-Jwb"> |
| 85 | - <rect key="frame" x="106" y="54" width="78" height="15"/> | |
| 76 | + <rect key="frame" x="121" y="57" width="64" height="15"/> | |
| 86 | 77 | <constraints> |
| 87 | 78 | <constraint firstAttribute="height" constant="15" id="ZwB-X4-TCe"/> |
| 88 | 79 | </constraints> |
| 89 | 80 | |
| 90 | 81 | |
| 91 | 82 | |
| 92 | 83 | |
| 93 | 84 | |
| 94 | 85 | |
| 95 | 86 | |
| 96 | 87 | |
| 97 | 88 | |
| 98 | 89 | |
| 99 | 90 | |
| 100 | 91 | |
| 101 | 92 | |
| ... | ... | @@ -90,37 +81,47 @@ |
| 90 | 81 | <nil key="textColor"/> |
| 91 | 82 | <nil key="highlightedColor"/> |
| 92 | 83 | </label> |
| 84 | + <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_rank_1" translatesAutoresizingMaskIntoConstraints="NO" id="RxI-g8-4hm"> | |
| 85 | + <rect key="frame" x="5" y="15" width="50" height="50"/> | |
| 86 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 87 | + <constraints> | |
| 88 | + <constraint firstAttribute="width" constant="50" id="Klg-CU-2CS"/> | |
| 89 | + <constraint firstAttribute="height" constant="50" id="bZk-fY-WIZ"/> | |
| 90 | + </constraints> | |
| 91 | + <userDefinedRuntimeAttributes> | |
| 92 | + <userDefinedRuntimeAttribute type="number" keyPath="layer.borderRadius"> | |
| 93 | + <integer key="value" value="5"/> | |
| 94 | + </userDefinedRuntimeAttribute> | |
| 95 | + </userDefinedRuntimeAttributes> | |
| 96 | + </imageView> | |
| 93 | 97 | </subviews> |
| 98 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 94 | 99 | <constraints> |
| 95 | - <constraint firstItem="doD-2D-mUh" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="57o-am-4IN"/> | |
| 96 | 100 | <constraint firstItem="esv-WJ-Jwb" firstAttribute="top" secondItem="LgT-0e-lsD" secondAttribute="bottom" constant="8" id="6Bw-Lm-urU"/> |
| 97 | - <constraint firstItem="yeV-e1-xLt" firstAttribute="leading" secondItem="LgT-0e-lsD" secondAttribute="trailing" constant="10" id="8hM-D0-kmc"/> | |
| 101 | + <constraint firstItem="1CW-Zi-SG6" firstAttribute="leading" secondItem="RxI-g8-4hm" secondAttribute="trailing" constant="8" id="8uQ-Mj-NFo"/> | |
| 98 | 102 | <constraint firstItem="LgT-0e-lsD" firstAttribute="top" secondItem="zAG-NS-RSG" secondAttribute="bottom" constant="8" id="Esk-56-nD6"/> |
| 99 | 103 | <constraint firstItem="zAG-NS-RSG" firstAttribute="trailing" secondItem="H2p-sc-9uM" secondAttribute="trailingMargin" id="GMx-VQ-Jq1"/> |
| 100 | - <constraint firstItem="doD-2D-mUh" firstAttribute="leading" secondItem="yeV-e1-xLt" secondAttribute="trailing" constant="8" id="Juh-q9-fxs"/> | |
| 104 | + <constraint firstItem="RxI-g8-4hm" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Kn2-D6-axQ"/> | |
| 101 | 105 | <constraint firstItem="zAG-NS-RSG" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" id="R9z-fc-ARl"/> |
| 102 | 106 | <constraint firstItem="esv-WJ-Jwb" firstAttribute="leading" secondItem="zAG-NS-RSG" secondAttribute="leading" id="Sfp-Ch-JEA"/> |
| 103 | 107 | <constraint firstItem="yeV-e1-xLt" firstAttribute="width" secondItem="LgT-0e-lsD" secondAttribute="width" id="Slm-k1-rIR"/> |
| 104 | - <constraint firstAttribute="bottom" secondItem="8qq-of-Fwv" secondAttribute="bottom" id="VVC-Dv-8ey"/> | |
| 105 | 108 | <constraint firstItem="A45-dY-zJ7" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Xwe-lc-LeM"/> |
| 109 | + <constraint firstAttribute="trailing" secondItem="yeV-e1-xLt" secondAttribute="trailing" constant="15" id="Zbx-pF-zZd"/> | |
| 106 | 110 | <constraint firstItem="LgT-0e-lsD" firstAttribute="leading" secondItem="1CW-Zi-SG6" secondAttribute="trailing" constant="8" id="dLZ-Nv-Dbr"/> |
| 107 | - <constraint firstItem="8qq-of-Fwv" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="dUj-3F-TgF"/> | |
| 108 | 111 | <constraint firstAttribute="trailing" secondItem="A45-dY-zJ7" secondAttribute="trailing" id="e8P-ju-Xmq"/> |
| 109 | 112 | <constraint firstItem="1CW-Zi-SG6" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="eCg-Ck-ONU"/> |
| 110 | 113 | <constraint firstItem="yeV-e1-xLt" firstAttribute="top" secondItem="zAG-NS-RSG" secondAttribute="bottom" constant="5" id="gYr-ss-0or"/> |
| 111 | - <constraint firstAttribute="trailing" secondItem="doD-2D-mUh" secondAttribute="trailing" constant="15" id="iNO-rk-u4D"/> | |
| 114 | + <constraint firstItem="RxI-g8-4hm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="5" id="uoo-ZV-klx"/> | |
| 112 | 115 | <constraint firstItem="zAG-NS-RSG" firstAttribute="leading" secondItem="1CW-Zi-SG6" secondAttribute="trailing" constant="8" id="vfh-9w-5DO"/> |
| 113 | - <constraint firstItem="8qq-of-Fwv" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="wiB-Bb-Ji6"/> | |
| 114 | 116 | <constraint firstItem="esv-WJ-Jwb" firstAttribute="width" secondItem="LgT-0e-lsD" secondAttribute="width" id="xkA-nN-FEv"/> |
| 115 | - <constraint firstItem="1CW-Zi-SG6" firstAttribute="leading" secondItem="8qq-of-Fwv" secondAttribute="trailing" constant="8" id="yFe-5g-aEi"/> | |
| 116 | 117 | <constraint firstAttribute="bottom" secondItem="A45-dY-zJ7" secondAttribute="bottom" id="yTG-Cb-Hp9"/> |
| 117 | 118 | </constraints> |
| 118 | 119 | </tableViewCellContentView> |
| 119 | - <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> | |
| 120 | + <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.26000000000000001" colorSpace="custom" customColorSpace="sRGB"/> | |
| 120 | 121 | <connections> |
| 121 | 122 | <outlet property="imgAvatar" destination="1CW-Zi-SG6" id="uph-nw-Xrp"/> |
| 123 | + <outlet property="imgRank" destination="RxI-g8-4hm" id="7rZ-J5-fLn"/> | |
| 122 | 124 | <outlet property="lblDistance" destination="yeV-e1-xLt" id="zdb-bf-Qqp"/> |
| 123 | - <outlet property="lblIndex" destination="8qq-of-Fwv" id="o6u-sg-ImL"/> | |
| 124 | 125 | <outlet property="lblName" destination="zAG-NS-RSG" id="TaI-LH-ibF"/> |
| 125 | 126 | <outlet property="lblStep" destination="LgT-0e-lsD" id="w46-KP-Adf"/> |
| 126 | 127 | <outlet property="lblTime" destination="esv-WJ-Jwb" id="nMR-Om-aj9"/> |
| ... | ... | @@ -128,8 +129,8 @@ |
| 128 | 129 | </tableViewCell> |
| 129 | 130 | </objects> |
| 130 | 131 | <resources> |
| 131 | - <image name="avatar_default" width="80" height="80"/> | |
| 132 | - <image name="tapbar_today" width="25" height="25"/> | |
| 132 | + <image name="avatar_default" width="127" height="136"/> | |
| 133 | + <image name="ic_rank_1" width="93" height="65"/> | |
| 133 | 134 | </resources> |
| 134 | 135 | </document> |
LifeLog/LifeLog/RankingViewController.h
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | NSDate * _endDate; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | +@property (weak, nonatomic) IBOutlet UIView *viewHeader; | |
| 19 | 20 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionTime; |
| 20 | 21 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionMode; |
| 21 | 22 | @property (weak, nonatomic) IBOutlet CollectionView *viewCollectionType; |
LifeLog/LifeLog/RankingViewController.m
| ... | ... | @@ -21,8 +21,9 @@ |
| 21 | 21 | - (void)viewDidLoad { |
| 22 | 22 | [super viewDidLoad]; |
| 23 | 23 | [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.bottomLayoutGuide attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.viewCollectionType attribute:NSLayoutAttributeBottom multiplier:1 constant:5]]; |
| 24 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 24 | 25 | // Do any additional setup after loading the view from its nib. |
| 25 | - self.title = NSLocalizedString(@"lifelog.rank.title", nil); | |
| 26 | +// self.title = NSLocalizedString(@"lifelog.rank.title", nil); | |
| 26 | 27 | |
| 27 | 28 | [self setupView]; |
| 28 | 29 | |
| ... | ... | @@ -85,6 +86,15 @@ |
| 85 | 86 | |
| 86 | 87 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { |
| 87 | 88 | RankingTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"RankCell"]; |
| 89 | + if(indexPath.row == 0) { | |
| 90 | + cell.imgRank.image = [UIImage imageNamed:@"ic_rank_1"]; | |
| 91 | + } else if(indexPath.row == 1) { | |
| 92 | + cell.imgRank.image = [UIImage imageNamed:@"ic_rank_2"]; | |
| 93 | + } else if(indexPath.row == 2) { | |
| 94 | + cell.imgRank.image = [UIImage imageNamed:@"ic_rank_3"]; | |
| 95 | + } else { | |
| 96 | + cell.imgRank.image = NULL; | |
| 97 | + } | |
| 88 | 98 | [cell setRankingData:[_curDataList objectAtIndex:indexPath.row]]; |
| 89 | 99 | return cell; |
| 90 | 100 | } |
LifeLog/LifeLog/RankingViewController.xib
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | <outlet property="viewCollectionMode" destination="B33-xX-Jro" id="HP4-Xb-LJm"/> |
| 18 | 18 | <outlet property="viewCollectionTime" destination="syA-uK-pbr" id="WdA-Cq-Flj"/> |
| 19 | 19 | <outlet property="viewCollectionType" destination="oUo-Eo-tz5" id="bjw-El-34G"/> |
| 20 | + <outlet property="viewHeader" destination="GBx-lY-9YI" id="IMV-pV-QhA"/> | |
| 20 | 21 | </connections> |
| 21 | 22 | </placeholder> |
| 22 | 23 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -24,6 +25,9 @@ |
| 24 | 25 | <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
| 25 | 26 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
| 26 | 27 | <subviews> |
| 28 | + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="background" translatesAutoresizingMaskIntoConstraints="NO" id="r1L-Yo-yok"> | |
| 29 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
| 30 | + </imageView> | |
| 27 | 31 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GBx-lY-9YI" userLabel="ViewHeader"> |
| 28 | 32 | <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> |
| 29 | 33 | <subviews> |
| ... | ... | @@ -51,7 +55,7 @@ |
| 51 | 55 | <state key="normal" image="icon_menu"/> |
| 52 | 56 | </button> |
| 53 | 57 | </subviews> |
| 54 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 58 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 55 | 59 | <constraints> |
| 56 | 60 | <constraint firstAttribute="bottom" secondItem="WGc-2i-Swk" secondAttribute="bottom" id="0hd-fk-kJG"/> |
| 57 | 61 | <constraint firstAttribute="bottom" secondItem="p97-40-8m9" secondAttribute="bottom" id="78G-b2-wAu"/> |
| ... | ... | @@ -85,6 +89,7 @@ |
| 85 | 89 | <subviews> |
| 86 | 90 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Ro-k6-fvT"> |
| 87 | 91 | <rect key="frame" x="0.0" y="0.0" width="375" height="40"/> |
| 92 | + <color key="backgroundColor" white="1" alpha="0.26000000000000001" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |
| 88 | 93 | <string key="text" base64-UTF8="YES"> |
| 89 | 94 | MjAxNuW5tCAx5pyIMjLml6XjgIDvvI3jgIAyMDE35bm0IDHmnIgyMeaXpQ0KAA |
| 90 | 95 | </string> |
| 91 | 96 | |
| 92 | 97 | |
| ... | ... | @@ -147,11 +152,15 @@ |
| 147 | 152 | </subviews> |
| 148 | 153 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
| 149 | 154 | <constraints> |
| 155 | + <constraint firstAttribute="bottom" secondItem="r1L-Yo-yok" secondAttribute="bottom" id="2FS-lA-RFH"/> | |
| 150 | 156 | <constraint firstItem="B33-xX-Jro" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="2Mu-hy-FVU"/> |
| 151 | - <constraint firstItem="GBx-lY-9YI" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="5CL-wT-MBg"/> | |
| 157 | + <constraint firstAttribute="trailing" secondItem="r1L-Yo-yok" secondAttribute="trailing" id="4oe-36-E65"/> | |
| 158 | + <constraint firstItem="GBx-lY-9YI" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="5CL-wT-MBg"/> | |
| 152 | 159 | <constraint firstItem="u5D-xz-8dK" firstAttribute="top" secondItem="syA-uK-pbr" secondAttribute="bottom" id="5uu-dZ-oXI"/> |
| 153 | 160 | <constraint firstItem="syA-uK-pbr" firstAttribute="top" secondItem="GBx-lY-9YI" secondAttribute="bottom" id="6FQ-vy-d4N"/> |
| 154 | 161 | <constraint firstItem="u5D-xz-8dK" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="75z-RN-ObF"/> |
| 162 | + <constraint firstItem="r1L-Yo-yok" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="8MA-f9-RUi"/> | |
| 163 | + <constraint firstItem="r1L-Yo-yok" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="E6k-kZ-HaE"/> | |
| 155 | 164 | <constraint firstItem="R3A-K9-MFe" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="LyL-9p-qcd"/> |
| 156 | 165 | <constraint firstItem="oUo-Eo-tz5" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="M7I-ue-lip"/> |
| 157 | 166 | <constraint firstAttribute="trailing" secondItem="B33-xX-Jro" secondAttribute="trailing" id="Pjd-Ay-GaV"/> |
| ... | ... | @@ -171,6 +180,7 @@ |
| 171 | 180 | </view> |
| 172 | 181 | </objects> |
| 173 | 182 | <resources> |
| 183 | + <image name="background" width="1563" height="2778"/> | |
| 174 | 184 | <image name="icon_left" width="30" height="30"/> |
| 175 | 185 | <image name="icon_menu" width="30" height="30"/> |
| 176 | 186 | <image name="icon_right" width="30" height="30"/> |
LifeLog/LifeLog/SNSViewController.h
LifeLog/LifeLog/SNSViewController.m
| ... | ... | @@ -25,8 +25,9 @@ |
| 25 | 25 | - (void)viewDidLoad { |
| 26 | 26 | [super viewDidLoad]; |
| 27 | 27 | // Do any additional setup after loading the view from its nib. |
| 28 | - self.title = NSLocalizedString(@"lifelog.tapbar.sns", nil); | |
| 29 | - | |
| 28 | +// self.title = NSLocalizedString(@"lifelog.tapbar.sns", nil); | |
| 29 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 30 | + | |
| 30 | 31 | [self callRequestToUpdateData]; |
| 31 | 32 | |
| 32 | 33 | //register nib for table view |
LifeLog/LifeLog/SNSViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 9 | 10 | </dependencies> |
| 10 | 11 | <objects> |
| ... | ... | @@ -12,6 +13,7 @@ |
| 12 | 13 | <connections> |
| 13 | 14 | <outlet property="tableBase" destination="KcG-O5-UhK" id="gDL-iU-n52"/> |
| 14 | 15 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| 16 | + <outlet property="viewHeader" destination="O4Q-H0-WBO" id="b3J-Om-x9l"/> | |
| 15 | 17 | </connections> |
| 16 | 18 | </placeholder> |
| 17 | 19 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -46,7 +48,7 @@ |
| 46 | 48 | <state key="normal" image="icon_menu"/> |
| 47 | 49 | </button> |
| 48 | 50 | </subviews> |
| 49 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 51 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.2196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 50 | 52 | <constraints> |
| 51 | 53 | <constraint firstItem="CJn-w1-o2o" firstAttribute="top" secondItem="O4Q-H0-WBO" secondAttribute="top" id="1zI-mI-RXX"/> |
| 52 | 54 | <constraint firstAttribute="trailing" secondItem="afS-51-Q5Z" secondAttribute="trailing" id="7I5-1M-8AE"/> |
| ... | ... | @@ -130,7 +132,7 @@ |
| 130 | 132 | </subviews> |
| 131 | 133 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
| 132 | 134 | <constraints> |
| 133 | - <constraint firstItem="O4Q-H0-WBO" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="0u7-Ks-LSt"/> | |
| 135 | + <constraint firstItem="O4Q-H0-WBO" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="0u7-Ks-LSt"/> | |
| 134 | 136 | <constraint firstAttribute="trailing" secondItem="O4Q-H0-WBO" secondAttribute="trailing" id="2pA-85-kwM"/> |
| 135 | 137 | <constraint firstItem="zzn-bU-X6s" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="4Uu-Hd-lEX"/> |
| 136 | 138 | <constraint firstItem="uB3-Sm-i6e" firstAttribute="top" secondItem="5ZL-zf-geZ" secondAttribute="bottom" constant="10" id="BBu-TF-Z8P"/> |
LifeLog/LifeLog/SearchGroupViewController.h
LifeLog/LifeLog/SearchGroupViewController.m
| ... | ... | @@ -25,6 +25,8 @@ |
| 25 | 25 | |
| 26 | 26 | - (void)viewDidLoad { |
| 27 | 27 | [super viewDidLoad]; |
| 28 | + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.viewHeader attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; | |
| 29 | + | |
| 28 | 30 | [self callRequestToUpdateData]; |
| 29 | 31 | |
| 30 | 32 | //register nib for table view |
LifeLog/LifeLog/SearchGroupViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12118" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| 9 | 10 | </dependencies> |
| 10 | 11 | <objects> |
| ... | ... | @@ -13,6 +14,7 @@ |
| 13 | 14 | <outlet property="tableBase" destination="yF3-ZN-ebL" id="WYE-g2-1iW"/> |
| 14 | 15 | <outlet property="textFieldSearch" destination="ZV5-M6-gge" id="my5-ga-rV2"/> |
| 15 | 16 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| 17 | + <outlet property="viewHeader" destination="YHv-ES-wQ0" id="QLI-K7-tqI"/> | |
| 16 | 18 | </connections> |
| 17 | 19 | </placeholder> |
| 18 | 20 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| ... | ... | @@ -50,7 +52,7 @@ |
| 50 | 52 | <state key="normal" image="icon_menu"/> |
| 51 | 53 | </button> |
| 52 | 54 | </subviews> |
| 53 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 55 | + <color key="backgroundColor" red="0.0" green="0.0" blue="0.21960784310000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
| 54 | 56 | <constraints> |
| 55 | 57 | <constraint firstItem="pK9-Nf-LNR" firstAttribute="leading" secondItem="YHv-ES-wQ0" secondAttribute="leading" id="84D-o2-cdT"/> |
| 56 | 58 | <constraint firstAttribute="trailing" secondItem="qQF-tf-31d" secondAttribute="trailing" id="BMv-VR-p7j"/> |
| ... | ... | @@ -145,7 +147,7 @@ |
| 145 | 147 | <constraint firstAttribute="trailing" secondItem="YHv-ES-wQ0" secondAttribute="trailing" id="crv-XZ-T34"/> |
| 146 | 148 | <constraint firstItem="yF3-ZN-ebL" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="f6n-Zr-w64"/> |
| 147 | 149 | <constraint firstItem="Rb5-To-ffT" firstAttribute="trailing" secondItem="V72-De-hhR" secondAttribute="trailing" id="fHS-Kk-Ew0"/> |
| 148 | - <constraint firstItem="YHv-ES-wQ0" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="fdM-w1-hOo"/> | |
| 150 | + <constraint firstItem="YHv-ES-wQ0" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" priority="750" id="fdM-w1-hOo"/> | |
| 149 | 151 | <constraint firstItem="V72-De-hhR" firstAttribute="top" secondItem="YHv-ES-wQ0" secondAttribute="bottom" constant="40" id="hlc-vb-EVo"/> |
| 150 | 152 | <constraint firstItem="Rb5-To-ffT" firstAttribute="width" secondItem="V72-De-hhR" secondAttribute="width" id="jtP-uw-vkF"/> |
| 151 | 153 | <constraint firstItem="ZV5-M6-gge" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="16" id="kxD-e8-dYm"/> |
LifeLog/LifeLog/TodayViewController.xib
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
| 3 | 3 | <device id="retina4_7" orientation="portrait"> |
| 4 | 4 | <adaptation id="fullscreen"/> |
| 5 | 5 | </device> |
| 6 | 6 | <dependencies> |
| 7 | - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | |
| 7 | + <deployment identifier="iOS"/> | |
| 8 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/> | |
| 8 | 9 | <capability name="Aspect ratio constraints" minToolsVersion="5.1"/> |
| 9 | 10 | <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> |
| 10 | 11 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| ... | ... | @@ -209,6 +210,10 @@ |
| 209 | 210 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
| 210 | 211 | <nil key="highlightedColor"/> |
| 211 | 212 | </label> |
| 213 | + <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jqx-9b-OkT"> | |
| 214 | + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
| 215 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | |
| 216 | + </imageView> | |
| 212 | 217 | </subviews> |
| 213 | 218 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
| 214 | 219 | <constraints> |