Commit e759cbb03c694dfdd25155d4319fe336d039b76d
1 parent
fcfef58783
Exists in
master
and in
1 other branch
Fix UI issue in SNS screen
Showing 10 changed files with 150 additions and 197 deletions Side-by-side Diff
- LifeLog/LifeLog/CreateGroupViewController.xib
- LifeLog/LifeLog/GroupDetailViewController.h
- LifeLog/LifeLog/GroupDetailViewController.m
- LifeLog/LifeLog/GroupDetailViewController.xib
- LifeLog/LifeLog/MyGroupViewController.h
- LifeLog/LifeLog/MyGroupViewController.m
- LifeLog/LifeLog/MyGroupViewController.xib
- LifeLog/LifeLog/SNSViewController.xib
- LifeLog/LifeLog/Utilities.h
- LifeLog/LifeLog/Utilities.m
LifeLog/LifeLog/CreateGroupViewController.xib
... | ... | @@ -30,52 +30,7 @@ |
30 | 30 | <rect key="frame" x="0.0" y="0.0" width="320" height="626"/> |
31 | 31 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
32 | 32 | <subviews> |
33 | - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QYv-QM-Bkk" userLabel="ViewHeader"> | |
34 | - <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
35 | - <subviews> | |
36 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="コミュニティー グループ作成" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hM-Gv-AxQ" customClass="AutoTransLabel"> | |
37 | - <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
38 | - <fontDescription key="fontDescription" type="system" pointSize="16"/> | |
39 | - <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
40 | - <nil key="highlightedColor"/> | |
41 | - <userDefinedRuntimeAttributes> | |
42 | - <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.title"/> | |
43 | - </userDefinedRuntimeAttributes> | |
44 | - </label> | |
45 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O23-Hy-4Ld"> | |
46 | - <rect key="frame" x="0.0" y="5" width="70" height="36"/> | |
47 | - <constraints> | |
48 | - <constraint firstAttribute="width" constant="70" id="8vZ-Ta-Rzv"/> | |
49 | - </constraints> | |
50 | - <state key="normal" image="today_back_button"/> | |
51 | - <connections> | |
52 | - <action selector="clickBack:" destination="-1" eventType="touchUpInside" id="BO6-jx-vuO"/> | |
53 | - </connections> | |
54 | - </button> | |
55 | - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fPg-VP-VkU"> | |
56 | - <rect key="frame" x="275" y="0.0" width="45" height="46"/> | |
57 | - <constraints> | |
58 | - <constraint firstAttribute="width" constant="45" id="k1W-Oc-mRq"/> | |
59 | - </constraints> | |
60 | - <state key="normal" image="icon_menu"/> | |
61 | - </button> | |
62 | - </subviews> | |
63 | - <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
64 | - <constraints> | |
65 | - <constraint firstAttribute="trailing" secondItem="9hM-Gv-AxQ" secondAttribute="trailing" id="5f8-Xt-vKd"/> | |
66 | - <constraint firstAttribute="bottom" secondItem="9hM-Gv-AxQ" secondAttribute="bottom" id="Q3z-hF-VbV"/> | |
67 | - <constraint firstItem="9hM-Gv-AxQ" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="XNi-3d-xFW"/> | |
68 | - <constraint firstItem="O23-Hy-4Ld" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="aMc-uz-vGA"/> | |
69 | - <constraint firstItem="fPg-VP-VkU" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="bLC-DU-cJf"/> | |
70 | - <constraint firstItem="9hM-Gv-AxQ" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="cUY-dT-Rh0"/> | |
71 | - <constraint firstAttribute="trailing" secondItem="fPg-VP-VkU" secondAttribute="trailing" id="fn0-SY-e1Z"/> | |
72 | - <constraint firstAttribute="height" constant="46" id="lBP-32-aFw"/> | |
73 | - <constraint firstItem="O23-Hy-4Ld" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" constant="5" id="ogR-c4-QQ3"/> | |
74 | - <constraint firstAttribute="bottom" secondItem="fPg-VP-VkU" secondAttribute="bottom" id="wdr-SH-Wm2"/> | |
75 | - <constraint firstAttribute="bottom" secondItem="O23-Hy-4Ld" secondAttribute="bottom" constant="5" id="yJ4-81-rJx"/> | |
76 | - </constraints> | |
77 | - </view> | |
78 | - <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aKu-bd-xMP" customClass="TPKeyboardAvoidingScrollView"> | |
33 | + <scrollView multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aKu-bd-xMP" customClass="TPKeyboardAvoidingScrollView"> | |
79 | 34 | <rect key="frame" x="0.0" y="46" width="320" height="580"/> |
80 | 35 | <subviews> |
81 | 36 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9w1-87-U1W"> |
82 | 37 | |
... | ... | @@ -575,10 +530,55 @@ |
575 | 530 | <constraint firstItem="9w1-87-U1W" firstAttribute="centerY" secondItem="aKu-bd-xMP" secondAttribute="centerY" id="DT9-CK-3ZL"/> |
576 | 531 | <constraint firstItem="9w1-87-U1W" firstAttribute="top" secondItem="aKu-bd-xMP" secondAttribute="top" id="PZC-BJ-DLV"/> |
577 | 532 | <constraint firstAttribute="trailing" secondItem="9w1-87-U1W" secondAttribute="trailing" id="RDM-mt-Fjr"/> |
578 | - <constraint firstAttribute="bottom" secondItem="9w1-87-U1W" secondAttribute="bottom" id="w42-vd-D7e"/> | |
533 | + <constraint firstAttribute="bottom" secondItem="9w1-87-U1W" secondAttribute="bottom" constant="50" id="w42-vd-D7e"/> | |
579 | 534 | <constraint firstItem="9w1-87-U1W" firstAttribute="centerX" secondItem="aKu-bd-xMP" secondAttribute="centerX" id="wJD-gn-ctq"/> |
580 | 535 | </constraints> |
581 | 536 | </scrollView> |
537 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QYv-QM-Bkk" userLabel="ViewHeader"> | |
538 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
539 | + <subviews> | |
540 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="コミュニティー グループ作成" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hM-Gv-AxQ" customClass="AutoTransLabel"> | |
541 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
542 | + <fontDescription key="fontDescription" type="system" pointSize="16"/> | |
543 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
544 | + <nil key="highlightedColor"/> | |
545 | + <userDefinedRuntimeAttributes> | |
546 | + <userDefinedRuntimeAttribute type="string" keyPath="localizeKey" value="lifelog.createGr.title"/> | |
547 | + </userDefinedRuntimeAttributes> | |
548 | + </label> | |
549 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="O23-Hy-4Ld"> | |
550 | + <rect key="frame" x="0.0" y="5" width="70" height="36"/> | |
551 | + <constraints> | |
552 | + <constraint firstAttribute="width" constant="70" id="8vZ-Ta-Rzv"/> | |
553 | + </constraints> | |
554 | + <state key="normal" image="today_back_button"/> | |
555 | + <connections> | |
556 | + <action selector="clickBack:" destination="-1" eventType="touchUpInside" id="BO6-jx-vuO"/> | |
557 | + </connections> | |
558 | + </button> | |
559 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fPg-VP-VkU"> | |
560 | + <rect key="frame" x="275" y="0.0" width="45" height="46"/> | |
561 | + <constraints> | |
562 | + <constraint firstAttribute="width" constant="45" id="k1W-Oc-mRq"/> | |
563 | + </constraints> | |
564 | + <state key="normal" image="icon_menu"/> | |
565 | + </button> | |
566 | + </subviews> | |
567 | + <color key="backgroundColor" red="0.098039215690000001" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |
568 | + <constraints> | |
569 | + <constraint firstAttribute="trailing" secondItem="9hM-Gv-AxQ" secondAttribute="trailing" id="5f8-Xt-vKd"/> | |
570 | + <constraint firstAttribute="bottom" secondItem="9hM-Gv-AxQ" secondAttribute="bottom" id="Q3z-hF-VbV"/> | |
571 | + <constraint firstItem="9hM-Gv-AxQ" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="XNi-3d-xFW"/> | |
572 | + <constraint firstItem="O23-Hy-4Ld" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="aMc-uz-vGA"/> | |
573 | + <constraint firstItem="fPg-VP-VkU" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" id="bLC-DU-cJf"/> | |
574 | + <constraint firstItem="9hM-Gv-AxQ" firstAttribute="leading" secondItem="QYv-QM-Bkk" secondAttribute="leading" id="cUY-dT-Rh0"/> | |
575 | + <constraint firstAttribute="trailing" secondItem="fPg-VP-VkU" secondAttribute="trailing" id="fn0-SY-e1Z"/> | |
576 | + <constraint firstAttribute="height" constant="46" id="lBP-32-aFw"/> | |
577 | + <constraint firstItem="O23-Hy-4Ld" firstAttribute="top" secondItem="QYv-QM-Bkk" secondAttribute="top" constant="5" id="ogR-c4-QQ3"/> | |
578 | + <constraint firstAttribute="bottom" secondItem="fPg-VP-VkU" secondAttribute="bottom" id="wdr-SH-Wm2"/> | |
579 | + <constraint firstAttribute="bottom" secondItem="O23-Hy-4Ld" secondAttribute="bottom" constant="5" id="yJ4-81-rJx"/> | |
580 | + </constraints> | |
581 | + </view> | |
582 | 582 | </subviews> |
583 | 583 | <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/> |
584 | 584 | <constraints> |
LifeLog/LifeLog/GroupDetailViewController.h
... | ... | @@ -23,9 +23,10 @@ |
23 | 23 | @property (weak, nonatomic) IBOutlet AutoTransButton *btJoinGrp; |
24 | 24 | @property (weak, nonatomic) IBOutlet AutoTransButton *btSwitch; |
25 | 25 | |
26 | -- (IBAction)clickBack:(id)sender; | |
27 | - | |
28 | 26 | - (void) setGroup : (GroupObject *) object; |
27 | +- (void) requestGroupDetail; | |
28 | + | |
29 | +- (IBAction)clickBack:(id)sender; | |
29 | 30 | - (IBAction)clickSwitch:(AutoTransButton *)sender; |
30 | 31 | - (IBAction)clickJoin:(AutoTransButton *)sender; |
31 | 32 | @end |
LifeLog/LifeLog/GroupDetailViewController.m
... | ... | @@ -41,24 +41,34 @@ |
41 | 41 | |
42 | 42 | - (void)setupView { |
43 | 43 | if(_curGroup != nil) { |
44 | - if(_curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { | |
44 | + if(self.imgAva != nil && _curGroup.avatar && ![_curGroup.avatar isKindOfClass:[NSNull class]]) { | |
45 | 45 | [self.imgAva sd_setImageWithURL:[NSURL URLWithString:[Utilities getImageLink:_curGroup.avatar]]]; |
46 | 46 | } |
47 | - [self.lblGrpName setText:_curGroup.name]; | |
48 | - [self.lblGrpGoal setText:_curGroup.goal]; | |
49 | - [self.btJoinGrp setHidden:_curGroup.isJoin]; | |
47 | + if(self.lblGrpName != nil) { | |
48 | + [self.lblGrpName setText:_curGroup.name]; | |
49 | + } | |
50 | + if(self.btJoinGrp != nil) { | |
51 | + [self.btJoinGrp setHidden:false]; | |
52 | + } | |
50 | 53 | NSString *mode = @""; |
54 | + NSString *goalText = [NSString stringWithFormat:@"%@\n", _curGroup.goal]; | |
55 | + if(_curGroup.runMode || _curGroup.walkMode || _curGroup.bikeMode) { | |
56 | + goalText = [goalText stringByAppendingString:@"1日 目標 "]; | |
57 | + } | |
51 | 58 | if(_curGroup.runMode) { |
52 | 59 | mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.running", nil)]; |
53 | 60 | mode = [mode stringByAppendingString:@"\n"]; |
61 | + goalText = [goalText stringByAppendingFormat:@"RUN %dm, ", _curGroup.runGoal]; | |
54 | 62 | } |
55 | 63 | if(_curGroup.walkMode) { |
56 | 64 | mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.walking", nil)]; |
57 | 65 | mode = [mode stringByAppendingString:@"\n"]; |
66 | + goalText = [goalText stringByAppendingFormat:@"WALK %dm, ", _curGroup.walkGoal]; | |
58 | 67 | } |
59 | 68 | if(_curGroup.bikeMode) { |
60 | 69 | mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.bike", nil)]; |
61 | 70 | mode = [mode stringByAppendingString:@"\n"]; |
71 | + goalText = [goalText stringByAppendingFormat:@"BIKE %dm, ", _curGroup.bikeGoal]; | |
62 | 72 | } |
63 | 73 | if(_curGroup.stepMode) { |
64 | 74 | mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.step", nil)]; |
65 | 75 | |
... | ... | @@ -76,9 +86,29 @@ |
76 | 86 | if(range.length > 0) { |
77 | 87 | mode = [mode stringByReplacingOccurrencesOfString:@"\n" withString:@"" options:NSBackwardsSearch range:range]; |
78 | 88 | } |
79 | - self.lbbGrpActiveMode.text = mode; | |
89 | + range = [goalText rangeOfString:@", " options:NSBackwardsSearch]; | |
90 | + if(range.length > 0) { | |
91 | + goalText = [goalText stringByReplacingOccurrencesOfString:@", " withString:@"" options:NSBackwardsSearch range:range]; | |
92 | + } | |
93 | + [self.lbbGrpActiveMode setText:mode]; | |
94 | + [self.lblGrpGoal setText:goalText]; | |
80 | 95 | } |
81 | 96 | } |
97 | + | |
98 | +- (void) requestGroupDetail { | |
99 | + NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
100 | + MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
101 | + [[ServerAPI server] getGroupDetail:token withGroupID:_curGroup.groupID CompletionHandler:^(GroupObject *object, NSError *error) { | |
102 | + GroupDetailViewController __weak *weakSelf = self; | |
103 | + [_curGroup updateDate:object]; | |
104 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
105 | + [hudView hideAnimated:true]; | |
106 | + [weakSelf setupView]; | |
107 | + [weakSelf callRequestToUpdateData]; | |
108 | + }); | |
109 | + }]; | |
110 | +} | |
111 | + | |
82 | 112 | #pragma mark IBAction |
83 | 113 | |
84 | 114 | - (IBAction)clickBack:(id)sender { |
... | ... | @@ -107,6 +137,7 @@ |
107 | 137 | if(error == nil) { |
108 | 138 | _curGroup.isJoin = true; |
109 | 139 | [weakSelf.btJoinGrp setHidden:_curGroup.isJoin]; |
140 | + [Utilities showMessage:@"Join successfully" withViewController:weakSelf]; | |
110 | 141 | } |
111 | 142 | }); |
112 | 143 | }]; |
... | ... | @@ -153,20 +184,6 @@ |
153 | 184 | } |
154 | 185 | |
155 | 186 | #pragma mark Private Function |
156 | - | |
157 | -- (void) requestGroupDetail { | |
158 | - NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
159 | - MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
160 | - [[ServerAPI server] getGroupDetail:token withGroupID:_curGroup.groupID CompletionHandler:^(GroupObject *object, NSError *error) { | |
161 | - GroupDetailViewController __weak *weakSelf = self; | |
162 | - [_curGroup updateDate:object]; | |
163 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
164 | - [hudView hideAnimated:true]; | |
165 | - [weakSelf setupView]; | |
166 | - [weakSelf callRequestToUpdateData]; | |
167 | - }); | |
168 | - }]; | |
169 | -} | |
170 | 187 | |
171 | 188 | -(void) callRequestToUpdateData { |
172 | 189 | [super callRequestToUpdateData]; |
LifeLog/LifeLog/GroupDetailViewController.xib
... | ... | @@ -22,14 +22,14 @@ |
22 | 22 | </placeholder> |
23 | 23 | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
24 | 24 | <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> |
25 | - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |
25 | + <rect key="frame" x="0.0" y="0.0" width="320" height="567"/> | |
26 | 26 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
27 | 27 | <subviews> |
28 | 28 | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="25d-3H-0fr" userLabel="ViewHeader"> |
29 | - <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
29 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
30 | 30 | <subviews> |
31 | 31 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SNS" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DxD-Cy-0wi" customClass="AutoTransLabel"> |
32 | - <rect key="frame" x="0.0" y="0.0" width="375" height="46"/> | |
32 | + <rect key="frame" x="0.0" y="0.0" width="320" height="46"/> | |
33 | 33 | <fontDescription key="fontDescription" type="system" pointSize="17"/> |
34 | 34 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
35 | 35 | <nil key="highlightedColor"/> |
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | </connections> |
49 | 49 | </button> |
50 | 50 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y09-DG-Krp"> |
51 | - <rect key="frame" x="330" y="0.0" width="45" height="46"/> | |
51 | + <rect key="frame" x="275" y="0.0" width="45" height="46"/> | |
52 | 52 | <constraints> |
53 | 53 | <constraint firstAttribute="width" constant="45" id="hHa-aE-1zd"/> |
54 | 54 | </constraints> |
55 | 55 | |
56 | 56 | |
... | ... | @@ -71,16 +71,16 @@ |
71 | 71 | </constraints> |
72 | 72 | </view> |
73 | 73 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YWV-pS-TCo"> |
74 | - <rect key="frame" x="15" y="54" width="345" height="21"/> | |
74 | + <rect key="frame" x="15" y="54" width="290" height="21"/> | |
75 | 75 | <constraints> |
76 | 76 | <constraint firstAttribute="height" constant="21" id="fQO-ja-W9R"/> |
77 | 77 | </constraints> |
78 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
78 | + <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
79 | 79 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
80 | 80 | <nil key="highlightedColor"/> |
81 | 81 | </label> |
82 | 82 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O8z-6V-YFd"> |
83 | - <rect key="frame" x="15" y="85" width="243" height="60"/> | |
83 | + <rect key="frame" x="15" y="85" width="188" height="60"/> | |
84 | 84 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
85 | 85 | <constraints> |
86 | 86 | <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="60" id="Bid-NM-Ree"/> |
87 | 87 | |
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | 91 | |
... | ... | @@ -90,27 +90,28 @@ |
90 | 90 | <nil key="highlightedColor"/> |
91 | 91 | </label> |
92 | 92 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bdy-dI-j47"> |
93 | - <rect key="frame" x="15" y="160" width="345" height="80"/> | |
93 | + <rect key="frame" x="15" y="160" width="290" height="0.0"/> | |
94 | 94 | <constraints> |
95 | - <constraint firstAttribute="height" constant="80" id="jgH-57-Bae"/> | |
95 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" id="jgH-57-Bae"/> | |
96 | 96 | </constraints> |
97 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
97 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
98 | 98 | <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
99 | 99 | <nil key="highlightedColor"/> |
100 | 100 | </label> |
101 | 101 | <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qYg-Gw-R2b"> |
102 | - <rect key="frame" x="280" y="85" width="80" height="60"/> | |
102 | + <rect key="frame" x="225" y="85" width="80" height="60"/> | |
103 | 103 | <constraints> |
104 | 104 | <constraint firstAttribute="width" constant="80" id="NEk-vg-zus"/> |
105 | 105 | <constraint firstAttribute="height" constant="60" id="qlv-ht-SUw"/> |
106 | 106 | </constraints> |
107 | 107 | </imageView> |
108 | 108 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gBg-k9-tgw" customClass="AutoTransButton"> |
109 | - <rect key="frame" x="15" y="270" width="162" height="30"/> | |
109 | + <rect key="frame" x="15" y="190" width="134.5" height="30"/> | |
110 | 110 | <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
111 | 111 | <constraints> |
112 | 112 | <constraint firstAttribute="height" constant="30" id="6Ir-ZZ-NOb"/> |
113 | 113 | </constraints> |
114 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
114 | 115 | <state key="normal" title="メンバーを見る"> |
115 | 116 | <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
116 | 117 | </state> |
117 | 118 | |
... | ... | @@ -125,11 +126,12 @@ |
125 | 126 | </connections> |
126 | 127 | </button> |
127 | 128 | <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="caN-x7-hJz" customClass="AutoTransButton"> |
128 | - <rect key="frame" x="197" y="270" width="162" height="30"/> | |
129 | + <rect key="frame" x="169.5" y="190" width="134.5" height="30"/> | |
129 | 130 | <color key="backgroundColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
130 | 131 | <constraints> |
131 | 132 | <constraint firstAttribute="height" constant="30" id="gIs-Km-dbx"/> |
132 | 133 | </constraints> |
134 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
133 | 135 | <state key="normal" title="グループに参加する"> |
134 | 136 | <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> |
135 | 137 | </state> |
... | ... | @@ -144,7 +146,7 @@ |
144 | 146 | </connections> |
145 | 147 | </button> |
146 | 148 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="4VU-Ye-7Au"> |
147 | - <rect key="frame" x="0.0" y="310" width="375" height="307"/> | |
149 | + <rect key="frame" x="0.0" y="230" width="320" height="287"/> | |
148 | 150 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
149 | 151 | <connections> |
150 | 152 | <outlet property="dataSource" destination="-1" id="TLB-6X-bRI"/> |
... | ... | @@ -179,6 +181,7 @@ |
179 | 181 | <constraint firstItem="Bdy-dI-j47" firstAttribute="top" secondItem="O8z-6V-YFd" secondAttribute="bottom" constant="15" id="xEO-fP-Riz"/> |
180 | 182 | <constraint firstAttribute="trailing" secondItem="4VU-Ye-7Au" secondAttribute="trailing" id="ylN-vm-QF2"/> |
181 | 183 | </constraints> |
184 | + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> | |
182 | 185 | <point key="canvasLocation" x="24.5" y="52.5"/> |
183 | 186 | </view> |
184 | 187 | </objects> |
LifeLog/LifeLog/MyGroupViewController.h
... | ... | @@ -7,27 +7,18 @@ |
7 | 7 | // |
8 | 8 | |
9 | 9 | #import <UIKit/UIKit.h> |
10 | -#import "BaseTableViewController.h" | |
10 | +#import "GroupDetailViewController.h" | |
11 | 11 | #import "AutoTransButton.h" |
12 | 12 | #import "Entities.h" |
13 | 13 | |
14 | -@interface MyGroupViewController : BaseTableViewController { | |
14 | +@interface MyGroupViewController : GroupDetailViewController { | |
15 | 15 | NSMutableArray *_curListGrp; |
16 | - GroupObject *_curGroup; | |
17 | - BOOL isMemberList; | |
18 | 16 | } |
19 | 17 | |
20 | 18 | @property (weak, nonatomic) IBOutlet UITableView *tableGrp; |
21 | - | |
22 | -@property (weak, nonatomic) IBOutlet UILabel *lblGroupName; | |
23 | -@property (weak, nonatomic) IBOutlet UILabel *lblActiveMode; | |
24 | -@property (weak, nonatomic) IBOutlet UILabel *lblGoal; | |
25 | 19 | @property (weak, nonatomic) IBOutlet UIButton *btShowGrp; |
26 | -@property (weak, nonatomic) IBOutlet AutoTransButton *btSwitch; | |
27 | 20 | |
28 | -- (IBAction)clickBack:(id)sender; | |
29 | 21 | - (IBAction)clickShowGrp:(id)sender; |
30 | -- (IBAction)clickSwitch:(id)sender; | |
31 | 22 | |
32 | 23 | @end |
LifeLog/LifeLog/MyGroupViewController.m
... | ... | @@ -34,42 +34,6 @@ |
34 | 34 | // Dispose of any resources that can be recreated. |
35 | 35 | } |
36 | 36 | |
37 | -- (void)setupView { | |
38 | - if(_curGroup != nil) { | |
39 | - [self.lblGoal setText:_curGroup.goal]; | |
40 | - NSString *mode = @""; | |
41 | - if(_curGroup.runMode) { | |
42 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.running", nil)]; | |
43 | - mode = [mode stringByAppendingString:@"\n"]; | |
44 | - } | |
45 | - if(_curGroup.walkMode) { | |
46 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.walking", nil)]; | |
47 | - mode = [mode stringByAppendingString:@"\n"]; | |
48 | - } | |
49 | - if(_curGroup.bikeMode) { | |
50 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.bike", nil)]; | |
51 | - mode = [mode stringByAppendingString:@"\n"]; | |
52 | - } | |
53 | - if(_curGroup.stepMode) { | |
54 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.step", nil)]; | |
55 | - mode = [mode stringByAppendingString:@"\n"]; | |
56 | - } | |
57 | - if(_curGroup.beginMode) { | |
58 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.begin", nil)]; | |
59 | - mode = [mode stringByAppendingString:@"\n"]; | |
60 | - } | |
61 | - if(_curGroup.gymMode) { | |
62 | - mode = [mode stringByAppendingString:NSLocalizedString(@"lifelog.grDetail.mode.gym", nil)]; | |
63 | - mode = [mode stringByAppendingString:@"\n"]; | |
64 | - } | |
65 | - NSRange range = [mode rangeOfString:@"\n" options:NSBackwardsSearch]; | |
66 | - if(range.length > 0) { | |
67 | - mode = [mode stringByReplacingOccurrencesOfString:@"\n" withString:@"" options:NSBackwardsSearch range:range]; | |
68 | - } | |
69 | - self.lblActiveMode.text = mode; | |
70 | - } | |
71 | -} | |
72 | - | |
73 | 37 | #pragma mark IBAction |
74 | 38 | |
75 | 39 | - (IBAction)clickBack:(id)sender { |
... | ... | @@ -171,7 +135,7 @@ |
171 | 135 | |
172 | 136 | - (void) resetGroupData : (int) index { |
173 | 137 | _curGroup = [_curListGrp objectAtIndex:index]; |
174 | - self.lblGroupName.text = _curGroup.name; | |
138 | + self.lblGrpName.text = _curGroup.name; | |
175 | 139 | [_curDataList removeAllObjects]; |
176 | 140 | [self.tableBase reloadData]; |
177 | 141 | [self requestGroupDetail]; |
... | ... | @@ -181,6 +145,9 @@ |
181 | 145 | NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; |
182 | 146 | MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; |
183 | 147 | [[ServerAPI server] requestGroupList:token CompletionHandler:^(NSArray *array, NSError *error) { |
148 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
149 | + [hudView hideAnimated:true]; | |
150 | + }); | |
184 | 151 | if(error == nil) { |
185 | 152 | [_curListGrp removeAllObjects]; |
186 | 153 | [_curListGrp addObjectsFromArray:array]; |
187 | 154 | |
... | ... | @@ -192,60 +159,12 @@ |
192 | 159 | [weakSelf resetGroupData:0]; |
193 | 160 | } |
194 | 161 | else { |
195 | - weakSelf.lblGroupName.text = @"No Group"; | |
162 | + weakSelf.lblGrpName.text = @"No Group"; | |
196 | 163 | } |
197 | 164 | [weakSelf.btShowGrp setEnabled:(_curListGrp.count > 0)]; |
198 | 165 | }); |
199 | 166 | } |
200 | 167 | }]; |
201 | -} | |
202 | - | |
203 | -- (void) requestGroupDetail { | |
204 | - NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
205 | - MBProgressHUD *hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
206 | - [[ServerAPI server] getGroupDetail:token withGroupID:_curGroup.groupID CompletionHandler:^(GroupObject *object, NSError *error) { | |
207 | - MyGroupViewController __weak *weakSelf = self; | |
208 | - [_curGroup updateDate:object]; | |
209 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
210 | - [hudView hideAnimated:true]; | |
211 | - [weakSelf setupView]; | |
212 | - [weakSelf callRequestToUpdateData]; | |
213 | - }); | |
214 | - }]; | |
215 | -} | |
216 | - | |
217 | --(void) callRequestToUpdateData { | |
218 | - [super callRequestToUpdateData]; | |
219 | - | |
220 | - NSString * token = [[NSUserDefaults standardUserDefaults] stringForKey:kToken]; | |
221 | - MBProgressHUD *hudView = nil; | |
222 | - if(_curPage == 1 && !self.refreshControl.isRefreshing) { | |
223 | - hudView = [MBProgressHUD showHUDAddedTo:self.view animated:true]; | |
224 | - } | |
225 | - if(isMemberList) { | |
226 | - [[ServerAPI server] requestMemberList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
227 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
228 | - if(hudView != nil) { | |
229 | - [hudView hideAnimated:true]; | |
230 | - } | |
231 | - }); | |
232 | - MyGroupViewController __weak *weakSelf = self; | |
233 | - [weakSelf updateTableData:array error:error]; | |
234 | - [weakSelf.btSwitch setUserInteractionEnabled:true]; | |
235 | - }]; | |
236 | - } | |
237 | - else { | |
238 | - [[ServerAPI server] requestTweetsList:token groupID:_curGroup.groupID withPage:_curPage CompletionHandler:^(NSArray *array, NSError *error){ | |
239 | - dispatch_async(dispatch_get_main_queue(), ^{ | |
240 | - if(hudView != nil) { | |
241 | - [hudView hideAnimated:true]; | |
242 | - } | |
243 | - }); | |
244 | - MyGroupViewController __weak *weakSelf = self; | |
245 | - [weakSelf updateTableData:array error:error]; | |
246 | - [weakSelf.btSwitch setUserInteractionEnabled:true]; | |
247 | - }]; | |
248 | - } | |
249 | 168 | } |
250 | 169 | |
251 | 170 | @end |
LifeLog/LifeLog/MyGroupViewController.xib
... | ... | @@ -12,9 +12,9 @@ |
12 | 12 | <connections> |
13 | 13 | <outlet property="btShowGrp" destination="MvK-5R-njL" id="bcb-N7-jbu"/> |
14 | 14 | <outlet property="btSwitch" destination="eBu-7L-nsx" id="od6-v0-6eh"/> |
15 | - <outlet property="lblActiveMode" destination="P1r-ft-imP" id="WRV-YQ-1IY"/> | |
16 | - <outlet property="lblGoal" destination="ftA-wa-19F" id="Ziv-cg-at5"/> | |
17 | - <outlet property="lblGroupName" destination="xXv-SO-m4h" id="yGe-lh-RC3"/> | |
15 | + <outlet property="lbbGrpActiveMode" destination="P1r-ft-imP" id="gw7-xu-kL1"/> | |
16 | + <outlet property="lblGrpGoal" destination="ftA-wa-19F" id="YFk-py-xd2"/> | |
17 | + <outlet property="lblGrpName" destination="xXv-SO-m4h" id="qik-wo-Usx"/> | |
18 | 18 | <outlet property="tableBase" destination="ubS-v9-zCa" id="gea-9H-gpI"/> |
19 | 19 | <outlet property="tableGrp" destination="dtD-J5-dze" id="ahq-Cd-85X"/> |
20 | 20 | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
21 | 21 | |
... | ... | @@ -83,9 +83,9 @@ |
83 | 83 | <action selector="clickShowGrp:" destination="-1" eventType="touchUpInside" id="yfd-Yu-fTF"/> |
84 | 84 | </connections> |
85 | 85 | </button> |
86 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xXv-SO-m4h"> | |
86 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="No group" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xXv-SO-m4h"> | |
87 | 87 | <rect key="frame" x="5" y="0.0" width="284" height="36"/> |
88 | - <fontDescription key="fontDescription" type="system" pointSize="16"/> | |
88 | + <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
89 | 89 | <nil key="textColor"/> |
90 | 90 | <nil key="highlightedColor"/> |
91 | 91 | </label> |
92 | 92 | |
93 | 93 | |
... | ... | @@ -115,17 +115,17 @@ |
115 | 115 | <constraints> |
116 | 116 | <constraint firstAttribute="height" constant="20" id="dx4-Lw-gRP"/> |
117 | 117 | </constraints> |
118 | - <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
118 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
119 | 119 | <nil key="textColor"/> |
120 | 120 | <nil key="highlightedColor"/> |
121 | 121 | </label> |
122 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P1r-ft-imP"> | |
122 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P1r-ft-imP"> | |
123 | 123 | <rect key="frame" x="8" y="36" width="155" height="61"/> |
124 | 124 | <constraints> |
125 | 125 | <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="61" id="6m3-4u-yjQ"/> |
126 | 126 | <constraint firstAttribute="width" constant="155" id="bJa-4P-B84"/> |
127 | 127 | </constraints> |
128 | - <fontDescription key="fontDescription" type="system" pointSize="15"/> | |
128 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
129 | 129 | <nil key="textColor"/> |
130 | 130 | <nil key="highlightedColor"/> |
131 | 131 | </label> |
132 | 132 | |
133 | 133 | |
134 | 134 | |
... | ... | @@ -158,17 +158,17 @@ |
158 | 158 | <constraint firstAttribute="bottom" secondItem="fXA-Zh-ABB" secondAttribute="bottom" constant="8" id="vRs-Al-kct"/> |
159 | 159 | </constraints> |
160 | 160 | </view> |
161 | - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ftA-wa-19F"> | |
162 | - <rect key="frame" x="15" y="218" width="345" height="100"/> | |
161 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ftA-wa-19F"> | |
162 | + <rect key="frame" x="15" y="218" width="345" height="40"/> | |
163 | 163 | <constraints> |
164 | - <constraint firstAttribute="height" constant="100" id="sns-tn-c0d"/> | |
164 | + <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="40" id="sns-tn-c0d"/> | |
165 | 165 | </constraints> |
166 | - <fontDescription key="fontDescription" type="system" pointSize="17"/> | |
167 | - <nil key="textColor"/> | |
166 | + <fontDescription key="fontDescription" type="system" pointSize="14"/> | |
167 | + <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | |
168 | 168 | <nil key="highlightedColor"/> |
169 | 169 | </label> |
170 | 170 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eBu-7L-nsx" customClass="AutoTransButton"> |
171 | - <rect key="frame" x="194" y="328" width="166" height="30"/> | |
171 | + <rect key="frame" x="194" y="268" width="166" height="30"/> | |
172 | 172 | <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/> |
173 | 173 | <constraints> |
174 | 174 | <constraint firstAttribute="width" constant="166" id="Rrn-lf-raV"/> |
... | ... | @@ -187,7 +187,7 @@ |
187 | 187 | </connections> |
188 | 188 | </button> |
189 | 189 | <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="none" rowHeight="100" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ubS-v9-zCa"> |
190 | - <rect key="frame" x="0.0" y="373" width="375" height="244"/> | |
190 | + <rect key="frame" x="0.0" y="313" width="375" height="304"/> | |
191 | 191 | <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> |
192 | 192 | <connections> |
193 | 193 | <outlet property="dataSource" destination="-1" id="HIG-w5-mXN"/> |
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="12121" 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="12118" systemVersion="16D32" 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 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/> | |
8 | 8 | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
9 | 9 | </dependencies> |
10 | 10 | <objects> |
LifeLog/LifeLog/Utilities.h
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | @interface Utilities : NSObject |
13 | 13 | + (NSString *)addCommaFromNumber:(NSInteger)number; |
14 | 14 | + (UIColor *)convertHecToColor:(int) hex; |
15 | ++ (void)showMessage:(NSString *)message withViewController:(UIViewController *)vc; | |
15 | 16 | + (void)showErrorMessage:(NSString *)message withViewController:(UIViewController *)vc; |
16 | 17 | + (NSString *) getImageLink : (NSString *) path; |
17 | 18 |
LifeLog/LifeLog/Utilities.m
... | ... | @@ -29,6 +29,28 @@ |
29 | 29 | blue:((float)(hex & 0xFF))/255.0 alpha:1.0]; |
30 | 30 | } |
31 | 31 | |
32 | ++ (void)showMessage:(NSString *)message withViewController:(UIViewController *)vc | |
33 | +{ | |
34 | + if (message.length > 0) { | |
35 | + UIAlertController * alert= [UIAlertController | |
36 | + alertControllerWithTitle:@"Message" | |
37 | + message:message | |
38 | + preferredStyle:UIAlertControllerStyleAlert]; | |
39 | + | |
40 | + UIAlertAction* ok = [UIAlertAction | |
41 | + actionWithTitle:@"OK" | |
42 | + style:UIAlertActionStyleDefault | |
43 | + handler:^(UIAlertAction * action) | |
44 | + { | |
45 | + [alert dismissViewControllerAnimated:YES completion:nil]; | |
46 | + }]; | |
47 | + | |
48 | + [alert addAction:ok]; | |
49 | + | |
50 | + [vc presentViewController:alert animated:YES completion:nil]; | |
51 | + } | |
52 | +} | |
53 | + | |
32 | 54 | + (void)showErrorMessage:(NSString *)message withViewController:(UIViewController *)vc |
33 | 55 | { |
34 | 56 | if (message.length > 0) { |
... | ... | @@ -43,7 +65,6 @@ |
43 | 65 | handler:^(UIAlertAction * action) |
44 | 66 | { |
45 | 67 | [alert dismissViewControllerAnimated:YES completion:nil]; |
46 | - | |
47 | 68 | }]; |
48 | 69 | |
49 | 70 | [alert addAction:ok]; |