Commit c3130f9ef72327440b59fc9c1179edf6c6ac43bd
1 parent
3d2de973
no message
Showing
19 changed files
with
619 additions
and
67 deletions
CNLiveScioLive.xcodeproj/project.pbxproj
| ... | ... | @@ -7,6 +7,15 @@ |
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | + 080AB4C1217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | |
| 11 | + 080AB4C2217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | |
| 12 | + 080AB4C3217AD47D008BA78F /* TemplateShareButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */; }; | |
| 13 | + 080AB4C6217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | |
| 14 | + 080AB4C7217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | |
| 15 | + 080AB4C8217AD4F4008BA78F /* TemplateShareManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */; }; | |
| 16 | + 080AB4CB217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | |
| 17 | + 080AB4CC217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | |
| 18 | + 080AB4CD217AD51A008BA78F /* XWShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 080AB4CA217AD51A008BA78F /* XWShareView.m */; }; | |
| 10 | 19 | 083847E1215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| 11 | 20 | 083847E2215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| 12 | 21 | 083847E3215C5DDD00186618 /* VPImageCropperViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */; }; |
| ... | ... | @@ -801,6 +810,12 @@ |
| 801 | 810 | /* End PBXCopyFilesBuildPhase section */ |
| 802 | 811 | |
| 803 | 812 | /* Begin PBXFileReference section */ |
| 813 | + 080AB4BF217AD47D008BA78F /* TemplateShareButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateShareButton.h; sourceTree = "<group>"; }; | |
| 814 | + 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TemplateShareButton.m; sourceTree = "<group>"; }; | |
| 815 | + 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TemplateShareManager.h; sourceTree = "<group>"; }; | |
| 816 | + 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TemplateShareManager.m; sourceTree = "<group>"; }; | |
| 817 | + 080AB4C9217AD51A008BA78F /* XWShareView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XWShareView.h; sourceTree = "<group>"; }; | |
| 818 | + 080AB4CA217AD51A008BA78F /* XWShareView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XWShareView.m; sourceTree = "<group>"; }; | |
| 804 | 819 | 083847DF215C5DDD00186618 /* VPImageCropperViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VPImageCropperViewController.h; sourceTree = "<group>"; }; |
| 805 | 820 | 083847E0215C5DDD00186618 /* VPImageCropperViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VPImageCropperViewController.m; sourceTree = "<group>"; }; |
| 806 | 821 | 083847ED215C633D00186618 /* WBHttpRequest+WeiboUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WBHttpRequest+WeiboUser.h"; sourceTree = "<group>"; }; |
| ... | ... | @@ -1350,6 +1365,19 @@ |
| 1350 | 1365 | /* End PBXFrameworksBuildPhase section */ |
| 1351 | 1366 | |
| 1352 | 1367 | /* Begin PBXGroup section */ |
| 1368 | + 080AB4BE217AD457008BA78F /* ShareTool */ = { | |
| 1369 | + isa = PBXGroup; | |
| 1370 | + children = ( | |
| 1371 | + 080AB4BF217AD47D008BA78F /* TemplateShareButton.h */, | |
| 1372 | + 080AB4C0217AD47D008BA78F /* TemplateShareButton.m */, | |
| 1373 | + 080AB4C4217AD4F4008BA78F /* TemplateShareManager.h */, | |
| 1374 | + 080AB4C5217AD4F4008BA78F /* TemplateShareManager.m */, | |
| 1375 | + 080AB4C9217AD51A008BA78F /* XWShareView.h */, | |
| 1376 | + 080AB4CA217AD51A008BA78F /* XWShareView.m */, | |
| 1377 | + ); | |
| 1378 | + path = ShareTool; | |
| 1379 | + sourceTree = "<group>"; | |
| 1380 | + }; | |
| 1353 | 1381 | 083847E9215C633D00186618 /* ShareSDK */ = { |
| 1354 | 1382 | isa = PBXGroup; |
| 1355 | 1383 | children = ( |
| ... | ... | @@ -2049,6 +2077,7 @@ |
| 2049 | 2077 | 08C08FCF214FA01B00E23D16 /* Tools */ = { |
| 2050 | 2078 | isa = PBXGroup; |
| 2051 | 2079 | children = ( |
| 2080 | + 080AB4BE217AD457008BA78F /* ShareTool */, | |
| 2052 | 2081 | 08585DD7215B70DA00FC2CA2 /* JSONKit */, |
| 2053 | 2082 | 08585D01215B4C7200FC2CA2 /* PGDatePicker */, |
| 2054 | 2083 | 085D86982159CBBB0037D480 /* CNLivePlayer */, |
| ... | ... | @@ -3081,6 +3110,7 @@ |
| 3081 | 3110 | 08C08FE3214FA01B00E23D16 /* CNLiveViewController.m in Sources */, |
| 3082 | 3111 | 0838483E215C838B00186618 /* CNLiveENTabBarController.m in Sources */, |
| 3083 | 3112 | 085D86C7215A20A50037D480 /* CNLiveUserSettingViewController.m in Sources */, |
| 3113 | + 080AB4CB217AD51A008BA78F /* XWShareView.m in Sources */, | |
| 3084 | 3114 | 084ACE0F21547F9F0089E035 /* DBAction.m in Sources */, |
| 3085 | 3115 | 08C0909C2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3086 | 3116 | 08585D59215B4C7200FC2CA2 /* PGDatePickManager.m in Sources */, |
| ... | ... | @@ -3112,6 +3142,7 @@ |
| 3112 | 3142 | 08C090792150C79C00E23D16 /* UIViewExt.m in Sources */, |
| 3113 | 3143 | 085D862C2159C72F0037D480 /* ZXVideoPlayerVolumeView.m in Sources */, |
| 3114 | 3144 | C3A6D0752152851400FB7759 /* ZXWUserInformation.m in Sources */, |
| 3145 | + 080AB4C6217AD4F4008BA78F /* TemplateShareManager.m in Sources */, | |
| 3115 | 3146 | 08585D6B215B4C7200FC2CA2 /* PGPickerColumnView.m in Sources */, |
| 3116 | 3147 | 08C0907C2150C79C00E23D16 /* ZXWKitConst.m in Sources */, |
| 3117 | 3148 | 08C090762150C79C00E23D16 /* ZXWSegment.m in Sources */, |
| ... | ... | @@ -3166,6 +3197,7 @@ |
| 3166 | 3197 | 08585DDA215B70DA00FC2CA2 /* JSONKit.m in Sources */, |
| 3167 | 3198 | 084ACE1D2154895E0089E035 /* GCPlaceholderTextView.m in Sources */, |
| 3168 | 3199 | 08940D882154F6FD00F85DB6 /* CNLiveNewsDetailModel.m in Sources */, |
| 3200 | + 080AB4C1217AD47D008BA78F /* TemplateShareButton.m in Sources */, | |
| 3169 | 3201 | 084ACE0221547B4D0089E035 /* CNLiveMyCollectionViewController.m in Sources */, |
| 3170 | 3202 | 084ACE1221547F9F0089E035 /* NoticeData.m in Sources */, |
| 3171 | 3203 | 08C08F81214F997F00E23D16 /* main.m in Sources */, |
| ... | ... | @@ -3231,6 +3263,7 @@ |
| 3231 | 3263 | 08585DB6215B4DA300FC2CA2 /* CNLiveAdvancedSearchViewController.m in Sources */, |
| 3232 | 3264 | 08384879215CC9E400186618 /* GraphicLiveViewController.m in Sources */, |
| 3233 | 3265 | 084ACE2D2154C6AA0089E035 /* CNLiveNewsThreePicTableViewCell.m in Sources */, |
| 3266 | + 080AB4C7217AD4F4008BA78F /* TemplateShareManager.m in Sources */, | |
| 3234 | 3267 | C3E502E0215245D900DA4320 /* CNHomeRightHeaderFooterView.m in Sources */, |
| 3235 | 3268 | 08FB8775215DD3C600DA5423 /* SelectedTableViewCell.m in Sources */, |
| 3236 | 3269 | 08940D892154F6FD00F85DB6 /* CNLiveNewsDetailModel.m in Sources */, |
| ... | ... | @@ -3296,6 +3329,7 @@ |
| 3296 | 3329 | 08FB876A215DD1C200DA5423 /* VoiceViewController.m in Sources */, |
| 3297 | 3330 | 08585D48215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, |
| 3298 | 3331 | 08C08F8B214F998000E23D16 /* CNLiveScioLiveTests.m in Sources */, |
| 3332 | + 080AB4C2217AD47D008BA78F /* TemplateShareButton.m in Sources */, | |
| 3299 | 3333 | 08C090772150C79C00E23D16 /* ZXWSegment.m in Sources */, |
| 3300 | 3334 | 085D869C2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, |
| 3301 | 3335 | 08585CE6215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, |
| ... | ... | @@ -3318,6 +3352,7 @@ |
| 3318 | 3352 | 08C0909D2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3319 | 3353 | C3E502DB2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, |
| 3320 | 3354 | 08585D6F215B4C7200FC2CA2 /* PGPickerView.m in Sources */, |
| 3355 | + 080AB4CC217AD51A008BA78F /* XWShareView.m in Sources */, | |
| 3321 | 3356 | 08C090472150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, |
| 3322 | 3357 | 08B5C56A215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, |
| 3323 | 3358 | 08C090B621510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, |
| ... | ... | @@ -3386,6 +3421,7 @@ |
| 3386 | 3421 | 08585DB7215B4DA300FC2CA2 /* CNLiveAdvancedSearchViewController.m in Sources */, |
| 3387 | 3422 | 0838487A215CC9E400186618 /* GraphicLiveViewController.m in Sources */, |
| 3388 | 3423 | 084ACE2E2154C6AA0089E035 /* CNLiveNewsThreePicTableViewCell.m in Sources */, |
| 3424 | + 080AB4C8217AD4F4008BA78F /* TemplateShareManager.m in Sources */, | |
| 3389 | 3425 | C3E502E1215245D900DA4320 /* CNHomeRightHeaderFooterView.m in Sources */, |
| 3390 | 3426 | 08FB8776215DD3C600DA5423 /* SelectedTableViewCell.m in Sources */, |
| 3391 | 3427 | 08940D8A2154F6FD00F85DB6 /* CNLiveNewsDetailModel.m in Sources */, |
| ... | ... | @@ -3451,6 +3487,7 @@ |
| 3451 | 3487 | 08FB876B215DD1C200DA5423 /* VoiceViewController.m in Sources */, |
| 3452 | 3488 | 08585D49215B4C7200FC2CA2 /* UIColor+PGHex.m in Sources */, |
| 3453 | 3489 | 08C08F96214F998000E23D16 /* CNLiveScioLiveUITests.m in Sources */, |
| 3490 | + 080AB4C3217AD47D008BA78F /* TemplateShareButton.m in Sources */, | |
| 3454 | 3491 | 08C090782150C79C00E23D16 /* ZXWSegment.m in Sources */, |
| 3455 | 3492 | 085D869D2159CBBB0037D480 /* CNLivePlayerController.m in Sources */, |
| 3456 | 3493 | 08585CE7215B302C00FC2CA2 /* CNLiveSearchViewController.m in Sources */, |
| ... | ... | @@ -3473,6 +3510,7 @@ |
| 3473 | 3510 | 08C0909E2150DCAC00E23D16 /* XWHTTPTool.m in Sources */, |
| 3474 | 3511 | C3E502DC2152432700DA4320 /* CNHomeRightTableViewCell.m in Sources */, |
| 3475 | 3512 | 08585D70215B4C7200FC2CA2 /* PGPickerView.m in Sources */, |
| 3513 | + 080AB4CD217AD51A008BA78F /* XWShareView.m in Sources */, | |
| 3476 | 3514 | 08C090482150BC6500E23D16 /* CNMyTableViewHeaderView.m in Sources */, |
| 3477 | 3515 | 08B5C56B215334CC00F5476E /* CNLiveSettingViewController.m in Sources */, |
| 3478 | 3516 | 08C090B721510E4B00E23D16 /* CNLiveTableViewCell.m in Sources */, | ... | ... |
CNLiveScioLive/AppDelegate.m
| ... | ... | @@ -43,8 +43,9 @@ |
| 43 | 43 | //分享 |
| 44 | 44 | [MobClick startWithAppkey:uMengKey reportPolicy:BATCH channelId:nil]; |
| 45 | 45 | [MobClick setLogEnabled:NO]; |
| 46 | - [self regiestShareSDK]; | |
| 47 | - | |
| 46 | +// [self regiestShareSDK]; | |
| 47 | + [[TemplateShareManager shareSingleton] shareConfig]; | |
| 48 | + | |
| 48 | 49 | //语言 |
| 49 | 50 | [self setApplicationLanguage]; |
| 50 | 51 | ... | ... |
CNLiveScioLive/Info.plist
| ... | ... | @@ -2,6 +2,10 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | + <key>MOBAppSecret</key> | |
| 6 | + <string>95c22305698a8218b58c6a0fc5fe630a</string> | |
| 7 | + <key>MOBAppKey</key> | |
| 8 | + <string>134f952a9e004</string> | |
| 5 | 9 | <key>CFBundleDevelopmentRegion</key> |
| 6 | 10 | <string>en</string> |
| 7 | 11 | <key>CFBundleDisplayName</key> | ... | ... |
CNLiveScioLive/Pages/Header/PrefixHeader.pch
CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsLeftPicTableViewCell.m
| ... | ... | @@ -91,42 +91,43 @@ |
| 91 | 91 | } |
| 92 | 92 | - (void)layoutSubviews{ |
| 93 | 93 | |
| 94 | - [_backgroundImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 94 | + [_backgroundImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 95 | 95 | make.left.equalTo(self.mas_left).with.offset(10); |
| 96 | 96 | make.right.equalTo(self.mas_right).with.offset(-10); |
| 97 | 97 | make.top.equalTo(self.mas_top).with.offset(5); |
| 98 | - make.bottom.equalTo(self.mas_bottom).with.offset(-5); | |
| 98 | + make.height.offset(80*MainScale+10); | |
| 99 | + | |
| 99 | 100 | }]; |
| 100 | 101 | |
| 101 | - [_picImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 102 | + [_picImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 102 | 103 | make.left.equalTo(self->_backgroundImage.mas_left).with.offset(5); |
| 103 | 104 | make.top.equalTo(self->_backgroundImage.mas_top).with.offset(5); |
| 104 | - make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); | |
| 105 | - make.width.offset((self->_backgroundImage.height-10)*16.0/9.0); | |
| 105 | + make.width.offset(80*MainScale*16.0/9.0); | |
| 106 | + make.height.offset(80*MainScale); | |
| 106 | 107 | |
| 107 | 108 | }]; |
| 108 | 109 | |
| 109 | - [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 110 | + [_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 110 | 111 | make.left.equalTo(self->_picImage.mas_right).with.offset(5); |
| 111 | 112 | make.top.equalTo(self->_backgroundImage.mas_top).with.offset(5); |
| 112 | 113 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-5); |
| 113 | 114 | |
| 114 | 115 | }]; |
| 115 | 116 | |
| 116 | - [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 117 | + [_timeLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 117 | 118 | make.left.equalTo(self->_picImage.mas_right).with.offset(5); |
| 118 | 119 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-5); |
| 119 | 120 | make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); |
| 120 | 121 | }]; |
| 121 | 122 | if ([_model.type isEqualToString:@"program"]) { |
| 122 | 123 | _playImage.hidden = NO; |
| 123 | - _playImage.frame = CGRectMake(10+5+((self->_backgroundImage.height-10)*16.0/9.0-30*MainScale)/2.0, (self.contentView.height-30*MainScale)/2.0, 30*MainScale, 30*MainScale); | |
| 124 | + _playImage.frame = CGRectMake(10+5+((80*MainScale)*16.0/9.0-30*MainScale)/2.0, (self.contentView.height-30*MainScale)/2.0, 30*MainScale, 30*MainScale); | |
| 124 | 125 | |
| 125 | 126 | } else if ([_model.type isEqualToString:@"subject"]) { |
| 126 | 127 | _playImage.hidden = YES; |
| 127 | 128 | |
| 128 | 129 | } |
| 129 | - [_projectLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 130 | + [_projectLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 130 | 131 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); |
| 131 | 132 | make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); |
| 132 | 133 | }]; | ... | ... |
CNLiveScioLive/Pages/Home/外宣要闻/View/CNLiveNewsUpPicTableViewCell.m
| ... | ... | @@ -92,14 +92,14 @@ |
| 92 | 92 | |
| 93 | 93 | } |
| 94 | 94 | - (void)layoutSubviews{ |
| 95 | - [_backgroundImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 95 | + [_backgroundImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 96 | 96 | make.left.equalTo(self.mas_left).with.offset(10); |
| 97 | 97 | make.right.equalTo(self.mas_right).with.offset(-10); |
| 98 | 98 | make.top.equalTo(self.mas_top).with.offset(5); |
| 99 | 99 | make.bottom.equalTo(self.mas_bottom).with.offset(-5); |
| 100 | 100 | }]; |
| 101 | 101 | |
| 102 | - [_picImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 102 | + [_picImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 103 | 103 | make.left.equalTo(self->_backgroundImage.mas_left).with.offset(5); |
| 104 | 104 | make.top.equalTo(self->_backgroundImage.mas_top).with.offset(5); |
| 105 | 105 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-5); |
| ... | ... | @@ -107,14 +107,14 @@ |
| 107 | 107 | |
| 108 | 108 | }]; |
| 109 | 109 | |
| 110 | - [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 110 | + [_titleLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 111 | 111 | make.left.equalTo(self->_backgroundImage.mas_left).with.offset(10); |
| 112 | 112 | make.top.equalTo(self->_picImage.mas_bottom).with.offset(5); |
| 113 | 113 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); |
| 114 | 114 | |
| 115 | 115 | }]; |
| 116 | 116 | |
| 117 | - [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 117 | + [_timeLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 118 | 118 | make.left.equalTo(self->_backgroundImage.mas_left).with.offset(10); |
| 119 | 119 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); |
| 120 | 120 | make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); |
| ... | ... | @@ -122,7 +122,7 @@ |
| 122 | 122 | |
| 123 | 123 | if ([_model.type isEqualToString:@"program"]) { |
| 124 | 124 | _playImage.hidden = NO; |
| 125 | - [_playImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 125 | + [_playImage mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 126 | 126 | make.left.equalTo(self->_backgroundImage.mas_left).with.offset((MainScreenWidth-20-50)/2); |
| 127 | 127 | make.top.equalTo(self->_picImage.mas_top).with.offset((200*MainHScale-50)/2); |
| 128 | 128 | make.width.offset(50); |
| ... | ... | @@ -138,7 +138,7 @@ |
| 138 | 138 | // }]; |
| 139 | 139 | |
| 140 | 140 | } |
| 141 | - [_projectLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 141 | + [_projectLabel mas_updateConstraints:^(MASConstraintMaker *make) { | |
| 142 | 142 | make.right.equalTo(self->_backgroundImage.mas_right).with.offset(-10); |
| 143 | 143 | make.bottom.equalTo(self->_backgroundImage.mas_bottom).with.offset(-5); |
| 144 | 144 | }]; | ... | ... |
CNLiveScioLive/Pages/Home/抽屉效果/Controller/CNHomeRightViewController.m
| ... | ... | @@ -24,6 +24,12 @@ static NSString *homeRightTableViewCell = @"CNHomeRightTableViewCell"; |
| 24 | 24 | static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 25 | 25 | |
| 26 | 26 | #pragma mark - Data |
| 27 | +- (void)getData:(NSNotification *)noti{ | |
| 28 | + NSLog(@"%@",noti.userInfo); | |
| 29 | + NSDictionary *dic = [noti userInfo]; | |
| 30 | + self.data = [dic objectForKey:@"titles"]; | |
| 31 | + [self.tableView reloadData]; | |
| 32 | +} | |
| 27 | 33 | |
| 28 | 34 | - (void)viewDidLoad { |
| 29 | 35 | [super viewDidLoad]; |
| ... | ... | @@ -31,16 +37,12 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 31 | 37 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getData:) name:@"CNHomeRightViewController" object:nil]; |
| 32 | 38 | |
| 33 | 39 | } |
| 34 | -- (void)getData:(NSNotification *)noti{ | |
| 35 | - NSLog(@"%@",noti.userInfo); | |
| 36 | - NSDictionary *dic = [noti userInfo]; | |
| 37 | - self.data = [dic objectForKey:@"titles"]; | |
| 38 | - [self.tableView reloadData]; | |
| 39 | -} | |
| 40 | + | |
| 40 | 41 | - (void)dealloc{ |
| 41 | 42 | [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 42 | 43 | |
| 43 | 44 | } |
| 45 | + | |
| 44 | 46 | - (void)didReceiveMemoryWarning { |
| 45 | 47 | [super didReceiveMemoryWarning]; |
| 46 | 48 | // Dispose of any resources that can be recreated. |
| ... | ... | @@ -127,6 +129,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 127 | 129 | [menu showRootViewControllerAnimated:true]; |
| 128 | 130 | |
| 129 | 131 | } |
| 132 | + | |
| 130 | 133 | /* |
| 131 | 134 | #pragma mark - Navigation |
| 132 | 135 | |
| ... | ... | @@ -146,16 +149,6 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 146 | 149 | CNLiveSearchViewController *search = [[CNLiveSearchViewController alloc]init]; |
| 147 | 150 | search.hidesBottomBarWhenPushed = YES; |
| 148 | 151 | [controllers pushViewController:search animated:YES]; |
| 149 | - | |
| 150 | -// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC); | |
| 151 | -// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | |
| 152 | -//// CNLiveTabBarController *liveTab = (CNLiveTabBarController *)vc.rootViewController; | |
| 153 | -//// CNLiveBaseNavigationController *controllers = liveTab.viewControllers[0]; | |
| 154 | -//// CNLiveSearchViewController *search = [[CNLiveSearchViewController alloc]init]; | |
| 155 | -//// [controllers pushViewController:search animated:YES]; | |
| 156 | -// [vc showRootViewControllerAnimated:true]; | |
| 157 | -// | |
| 158 | -// }); | |
| 159 | 152 | [vc showRootViewControllerAnimated:true]; |
| 160 | 153 | |
| 161 | 154 | } |
| ... | ... | @@ -166,11 +159,6 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 166 | 159 | [AlertViewTool showHUDViewText:@"您未连接网络,请联网后重试!"]; |
| 167 | 160 | return; |
| 168 | 161 | } |
| 169 | -// KJARSCanViewController *scanView = [[KJARSCanViewController alloc] init]; | |
| 170 | -// [scanView SetAccountKey:@"AP6caf76bc2c5f45698c74ef7e126703e1" :@"3f57c704ff9f4c8d82a575db5c7abe12"]; | |
| 171 | -// scanView.hidesBottomBarWhenPushed = YES; | |
| 172 | -// [self.navigationController pushViewController:scanView animated:YES]; | |
| 173 | - | |
| 174 | 162 | |
| 175 | 163 | XLSlideMenu *vc = (XLSlideMenu *)self.parentViewController; |
| 176 | 164 | CNLiveTabBarController *liveTab = (CNLiveTabBarController *)vc.rootViewController; |
| ... | ... | @@ -180,6 +168,7 @@ static NSString *homeRightHeaderFooterView = @"CNHomeRightHeaderFooterView"; |
| 180 | 168 | scanView.hidesBottomBarWhenPushed = YES; |
| 181 | 169 | [controllers pushViewController:scanView animated:YES]; |
| 182 | 170 | [vc showRootViewControllerAnimated:true]; |
| 171 | + | |
| 183 | 172 | } |
| 184 | 173 | #pragma mark - Lazy Laoding |
| 185 | 174 | - (UITableView *)tableView{ | ... | ... |
CNLiveScioLive/Pages/Home/抽屉效果/View/CNHomeRightHeaderFooterView.m
| ... | ... | @@ -28,19 +28,20 @@ |
| 28 | 28 | _backgroundImage.backgroundColor = [UIColor whiteColor]; |
| 29 | 29 | [self.contentView addSubview:_backgroundImage]; |
| 30 | 30 | |
| 31 | - _picImage = [[UIImageView alloc] init]; | |
| 32 | - _picImage.contentMode = UIViewContentModeCenter; | |
| 33 | - _picImage.layer.masksToBounds = YES; | |
| 34 | - _picImage.userInteractionEnabled = YES; | |
| 35 | - [self.contentView addSubview:_picImage]; | |
| 36 | - | |
| 37 | 31 | _titleLabel = [[UILabel alloc] init]; |
| 38 | 32 | _titleLabel.numberOfLines = 1; |
| 39 | 33 | _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail; |
| 40 | 34 | _titleLabel.textColor = HEXCOLOR(0x333333); |
| 35 | + _titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 41 | 36 | _titleLabel.font = [UIFont systemFontOfSize:16]; |
| 42 | 37 | [self.contentView addSubview:_titleLabel]; |
| 43 | 38 | |
| 39 | + _picImage = [[UIImageView alloc] init]; | |
| 40 | + _picImage.contentMode = UIViewContentModeCenter; | |
| 41 | + _picImage.layer.masksToBounds = YES; | |
| 42 | + _picImage.userInteractionEnabled = YES; | |
| 43 | + [self.contentView addSubview:_picImage]; | |
| 44 | + | |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | 47 | return self; |
| ... | ... | @@ -71,20 +72,23 @@ |
| 71 | 72 | make.left.equalTo(self.mas_left).with.offset(0); |
| 72 | 73 | make.right.equalTo(self.mas_right).with.offset(0); |
| 73 | 74 | }]; |
| 74 | - | |
| 75 | - [_picImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 75 | + | |
| 76 | + UIFont *font = [UIFont systemFontOfSize:16]; | |
| 77 | + CGSize size = CGSizeMake(MAXFLOAT, 30.0f); | |
| 78 | + CGFloat titleWidth = [_title boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName:font } context:nil].size.width; | |
| 79 | + [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 80 | + make.left.equalTo(self.mas_left).with.offset((self.width-titleWidth)/2.0); | |
| 76 | 81 | make.top.equalTo(self.mas_top).with.offset(0); |
| 77 | 82 | make.bottom.equalTo(self.mas_bottom).with.offset(0); |
| 78 | - make.left.equalTo(self.mas_left).with.offset(20); | |
| 79 | - make.width.offset(20); | |
| 80 | 83 | }]; |
| 81 | 84 | |
| 82 | - [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 83 | - make.left.equalTo(self->_picImage.mas_right).with.offset(10); | |
| 85 | + [_picImage mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 84 | 86 | make.top.equalTo(self.mas_top).with.offset(0); |
| 85 | 87 | make.bottom.equalTo(self.mas_bottom).with.offset(0); |
| 88 | + make.right.equalTo(self->_titleLabel.mas_left).with.offset(-10); | |
| 89 | + make.width.offset(20); | |
| 86 | 90 | }]; |
| 87 | - | |
| 91 | + | |
| 88 | 92 | } |
| 89 | 93 | /* |
| 90 | 94 | // Only override drawRect: if you perform custom drawing. | ... | ... |
CNLiveScioLive/Pages/Live/Controller/GraphicLiveViewController.m
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | [self.videoController stop]; |
| 17 | 17 | [self.navigationController popViewControllerAnimated:YES]; |
| 18 | 18 | } |
| 19 | --(id)initWithDictionary:(NSDictionary*)dictionary { | |
| 19 | +- (id)initWithDictionary:(NSDictionary*)dictionary { | |
| 20 | 20 | if (self = [super init]) { |
| 21 | 21 | _dictionary = [NSDictionary dictionaryWithDictionary:dictionary]; |
| 22 | 22 | int status = [_dictionary[@"status"] intValue]; |
| ... | ... | @@ -45,7 +45,6 @@ |
| 45 | 45 | return self; |
| 46 | 46 | } |
| 47 | 47 | - (NSString *)setHTMLString { |
| 48 | -// NSString* htmlHeader = [[NSString alloc] initWithFormat:@"<html><p><font style=\"font-size:20px;\"><strong>%@</strong></font><br>%@</p><body>",[_dic objectForKey:@"Tittle"],[_dic objectForKey:@"PublishDateTime"]]; | |
| 49 | 48 | NSString* htmlBody = [[NSString alloc] initWithFormat:@"<p><font style=\"font-size:%@px;\">%@</font></p>",fontArray[fontIndex],[_dic objectForKey:@"Content"]]; |
| 50 | 49 | NSString* htmlFooter = @"</body></html>"; |
| 51 | 50 | NSString* strHtml = [[NSString alloc] initWithFormat:@"%@%@",htmlBody,htmlFooter]; |
| ... | ... | @@ -100,7 +99,7 @@ |
| 100 | 99 | [super viewDidLoad]; |
| 101 | 100 | self.view.backgroundColor = [UIColor whiteColor]; |
| 102 | 101 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pausePlayer) name:@"PausePlayerNotification" object:nil]; |
| 103 | - fontIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"FontSize"]; | |
| 102 | + fontIndex = (int)[[NSUserDefaults standardUserDefaults] integerForKey:@"FontSize"]; | |
| 104 | 103 | heightArr = [NSMutableArray arrayWithArray:@[@"0",@"0",@"0"]]; |
| 105 | 104 | fontArray = @[@"16",@"20",@"24"]; |
| 106 | 105 | |
| ... | ... | @@ -259,7 +258,7 @@ |
| 259 | 258 | lineImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 1)]; |
| 260 | 259 | lineImage1.backgroundColor = Color_Line; |
| 261 | 260 | [backgroundView addSubview:lineImage1]; |
| 262 | - | |
| 261 | + | |
| 263 | 262 | upDownButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 264 | 263 | [upDownButton addTarget:self action:@selector(showGraphicLive:) forControlEvents:UIControlEventTouchUpInside]; |
| 265 | 264 | [upDownButton setFrame:CGRectMake(0, descriptionHeight, MainScreenWidth, 40)]; |
| ... | ... | @@ -279,9 +278,9 @@ |
| 279 | 278 | lineImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 40 + descriptionHeight, MainScreenWidth, 1)]; |
| 280 | 279 | lineImage2.backgroundColor = Color_Line; |
| 281 | 280 | [backgroundView addSubview:lineImage2]; |
| 282 | - | |
| 281 | + | |
| 283 | 282 | [backgroundView setContentSize:CGSizeMake(MainScreenWidth, 40 + descriptionHeight + 960)]; |
| 284 | - | |
| 283 | + | |
| 285 | 284 | _webView = [[UIWebView alloc] initWithFrame:CGRectZero]; |
| 286 | 285 | _webView.scrollView.backgroundColor = [UIColor clearColor]; |
| 287 | 286 | _webView.dataDetectorTypes = UIDataDetectorTypeNone; |
| ... | ... | @@ -293,6 +292,7 @@ |
| 293 | 292 | _webView.tag = 2000; |
| 294 | 293 | |
| 295 | 294 | [backgroundView addSubview:_webView]; |
| 295 | + | |
| 296 | 296 | relatedInformationView = [[UIView alloc] initWithFrame:CGRectMake(0, 40 + descriptionHeight, MainScreenWidth, 960)]; |
| 297 | 297 | [backgroundView addSubview:relatedInformationView]; |
| 298 | 298 | ... | ... |
CNLiveScioLive/Pages/Live/View/CNLiveHeaderView.h
CNLiveScioLive/Pages/My/CNMyTableViewHeaderView.m
| ... | ... | @@ -107,18 +107,11 @@ |
| 107 | 107 | CGSize size = CGSizeMake(MAXFLOAT, 30.0f); |
| 108 | 108 | CGFloat buttonWidth = [content boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{ NSFontAttributeName:font } context:nil].size.width+10; |
| 109 | 109 | |
| 110 | -// _clickedBtn.frame = CGRectMake(_headerImage.right+10, (self.height-30)/2.0, buttonWidth, 30); | |
| 111 | 110 | [_clickedBtn mas_updateConstraints:^(MASConstraintMaker *make) { |
| 112 | 111 | make.left.equalTo(self->_headerImage.mas_right).with.offset(10); |
| 113 | 112 | make.centerY.equalTo(self.mas_centerY); |
| 114 | 113 | make.width.offset(buttonWidth); |
| 115 | 114 | }]; |
| 116 | -// [_clickedBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 117 | -// make.left.equalTo(self->_headerImage.mas_right).with.offset(20); | |
| 118 | -// make.centerY.equalTo(self.mas_centerY); | |
| 119 | -// make.width.offset(buttonWidth); | |
| 120 | -// | |
| 121 | -// }]; | |
| 122 | 115 | |
| 123 | 116 | } |
| 124 | 117 | - (void)clickedLoginBtn{ | ... | ... |
CNLiveScioLive/Pages/Tools/DBAction/DBAction.m
| ... | ... | @@ -55,7 +55,7 @@ static DBAction *instance = nil; |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -- (BOOL)isInNoticeTable:(NoticeData*)notice{ | |
| 58 | +- (BOOL)isInNoticeTable:(NoticeData *)notice{ | |
| 59 | 59 | if ([db open]) { |
| 60 | 60 | NSString * check = [NSString stringWithFormat:@"SELECT * FROM NOTICE where time = %@",notice.time]; |
| 61 | 61 | FMResultSet * re = [db executeQuery:check]; | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareButton.h
0 → 100644
| 1 | +// | |
| 2 | +// TemplateShareButton.h | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +NS_ASSUME_NONNULL_BEGIN | |
| 12 | +typedef NS_ENUM(NSUInteger, TemplateShareButtonType) { | |
| 13 | + TemplateShareButtonTypeWeiBo = 0,//微博 | |
| 14 | + TemplateShareButtonTypeWeiXin = 1,//微信好友 | |
| 15 | + TemplateShareButtonTypePengYouQuan = 2,//微信朋友圈 | |
| 16 | + TemplateShareButtonTypeQQ = 3,//QQ好友 | |
| 17 | + TemplateShareButtonTypeQQZone = 4,//QQ空间 | |
| 18 | + TemplateShareButtonTypeTXWeiBo = 5,//腾讯微博 | |
| 19 | + TemplateShareButtonTypeXLWeiBo = 6,//新浪微博 | |
| 20 | + TemplateShareButtonTypeRenRen = 7,//人人网 | |
| 21 | + TemplateShareButtonTypeJuBao = 8//举报 | |
| 22 | +}; | |
| 23 | + | |
| 24 | +@interface TemplateShareButton : UIButton | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * 分享的类型(新浪微博,微信,朋友圈,QQ,QQ空间,腾讯微博,人人,举报) | |
| 28 | + */ | |
| 29 | +@property (nonatomic,assign) TemplateShareButtonType shareButtonType; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * 各个渠道的title | |
| 33 | + */ | |
| 34 | +@property (nonatomic,strong) NSString *title; | |
| 35 | + | |
| 36 | +/** | |
| 37 | + * 各个渠道的图标 | |
| 38 | + */ | |
| 39 | +@property (nonatomic,strong) NSString *image; | |
| 40 | + | |
| 41 | +@end | |
| 42 | + | |
| 43 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareButton.m
0 → 100644
| 1 | +// | |
| 2 | +// TemplateShareButton.m | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "TemplateShareButton.h" | |
| 10 | + | |
| 11 | +@implementation TemplateShareButton{ | |
| 12 | + UILabel *_titleLabel; | |
| 13 | +} | |
| 14 | + | |
| 15 | +- (id)initWithFrame:(CGRect)frame{ | |
| 16 | + self = [super initWithFrame:frame]; | |
| 17 | + if (self) { | |
| 18 | + self.imageEdgeInsets = UIEdgeInsetsMake(10.0f,10.0f, 10.0f, 10.0f); | |
| 19 | + _titleLabel = [[UILabel alloc]init]; | |
| 20 | + _titleLabel.font = [UIFont fontWithName:@"SourceHanSansCN-Regular" size:12.f]; | |
| 21 | + _titleLabel.textColor = [ UIColor colorWithRed:255.0 green:255.0 blue:255.0 alpha:1]; | |
| 22 | + _titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 23 | + [self addSubview:_titleLabel]; | |
| 24 | + | |
| 25 | + } | |
| 26 | + return self; | |
| 27 | +} | |
| 28 | + | |
| 29 | +#pragma mark -- Getter and Setter | |
| 30 | +- (void)setTitle:(NSString *)title{ | |
| 31 | + _title = title; | |
| 32 | + _titleLabel.text = _title; | |
| 33 | +} | |
| 34 | + | |
| 35 | +- (void)setImage:(NSString *)image{ | |
| 36 | + _image = image; | |
| 37 | + [self setImage:[UIImage imageNamed:image] forState:UIControlStateNormal]; | |
| 38 | + | |
| 39 | +} | |
| 40 | + | |
| 41 | +- (void)layoutSubviews{ | |
| 42 | + [super layoutSubviews]; | |
| 43 | + _titleLabel.frame = CGRectMake(0, self.frame.size.width, self.frame.size.width, 12.0f); | |
| 44 | + | |
| 45 | +} | |
| 46 | + | |
| 47 | +@end | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareManager.h
0 → 100644
| 1 | +// | |
| 2 | +// TemplateShareManager.h | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | +#import "TemplateShareButton.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | + | |
| 14 | +@interface TemplateShareManager : NSObject | |
| 15 | + | |
| 16 | ++ (instancetype)shareSingleton; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * 注册分享以及配置信息 | |
| 20 | + */ | |
| 21 | +- (void)shareConfig; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 设置分享内容 | |
| 25 | + * | |
| 26 | + * @param type 分享渠道 | |
| 27 | + * @param shareText 分享内嵌文字 | |
| 28 | + * @param shareImage 分享内嵌图片,可以传入UIImage或者NSData类型 | |
| 29 | + * @param shareUrl 分享消息url地址 | |
| 30 | + */ | |
| 31 | +- (void)shareType:(TemplateShareButtonType)type shareImage:(id)shareImage shareTitle:(NSString *)shareTitle shareText:(NSString *)shareText shareUrl:(NSString *)shareUrl; | |
| 32 | + | |
| 33 | +@end | |
| 34 | + | |
| 35 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/TemplateShareManager.m
0 → 100644
| 1 | +// | |
| 2 | +// TemplateShareManager.m | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "TemplateShareManager.h" | |
| 10 | +#import "TemplateShareButton.h" | |
| 11 | + | |
| 12 | +@implementation TemplateShareManager | |
| 13 | + | |
| 14 | +static TemplateShareManager *shareManaager = nil; | |
| 15 | ++ (TemplateShareManager *)shareSingleton{ | |
| 16 | + @synchronized(self){ | |
| 17 | + if (shareManaager == nil) { | |
| 18 | + shareManaager = [[TemplateShareManager alloc] init]; | |
| 19 | + } | |
| 20 | + } | |
| 21 | + return shareManaager; | |
| 22 | +} | |
| 23 | + | |
| 24 | +#pragma mark 注册友盟分享以及配置信息 | |
| 25 | +- (void)shareConfig | |
| 26 | +{ | |
| 27 | + [ShareSDK registerApp:@"134f952a9e004" activePlatforms:@[@(SSDKPlatformTypeSinaWeibo), | |
| 28 | + @(SSDKPlatformSubTypeWechatSession), | |
| 29 | + @(SSDKPlatformSubTypeWechatTimeline), | |
| 30 | + @(SSDKPlatformTypeQQ)] | |
| 31 | + onImport:^(SSDKPlatformType platformType) | |
| 32 | + { | |
| 33 | + switch (platformType) | |
| 34 | + { | |
| 35 | + case SSDKPlatformTypeWechat: | |
| 36 | + [ShareSDKConnector connectWeChat:[WXApi class]]; | |
| 37 | + break; | |
| 38 | + case SSDKPlatformTypeQQ: | |
| 39 | + [ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]]; | |
| 40 | + break; | |
| 41 | + case SSDKPlatformTypeSinaWeibo: | |
| 42 | + [ShareSDKConnector connectWeibo:[WeiboSDK class]]; | |
| 43 | + break; | |
| 44 | + default: | |
| 45 | + break; | |
| 46 | + } | |
| 47 | + } | |
| 48 | + onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo) | |
| 49 | + { | |
| 50 | + | |
| 51 | + switch (platformType) | |
| 52 | + { | |
| 53 | + case SSDKPlatformTypeSinaWeibo: | |
| 54 | + //设置新浪微博应用信息,其中authType设置为使用SSO+Web形式授权 | |
| 55 | + [appInfo SSDKSetupSinaWeiboByAppKey:@"604714517" | |
| 56 | + appSecret:@"542573f3d166742a230634d5c2576157" | |
| 57 | + redirectUri:@"https://api.weibo.com/oauth2/default.html" | |
| 58 | + authType:SSDKAuthTypeBoth]; | |
| 59 | + break; | |
| 60 | + case SSDKPlatformTypeWechat: | |
| 61 | + [appInfo SSDKSetupWeChatByAppId:@"wx1eb184b8425c2503" | |
| 62 | + appSecret:@"4d250e1ef3b7f5f1bc3579237fd4ee62"]; | |
| 63 | + break; | |
| 64 | + case SSDKPlatformTypeQQ: | |
| 65 | + [appInfo SSDKSetupQQByAppId:@"1105424006" | |
| 66 | + appKey:@"EneqtYjiKSswk05g" | |
| 67 | + authType:SSDKAuthTypeBoth]; | |
| 68 | + break; | |
| 69 | + default: | |
| 70 | + break; | |
| 71 | + } | |
| 72 | + }]; | |
| 73 | + | |
| 74 | +} | |
| 75 | + | |
| 76 | +- (void)shareType:(TemplateShareButtonType)type shareImage:(id)shareImage shareTitle:(NSString *)shareTitle shareText:(NSString *)shareText shareUrl:(NSString *)shareUrl{ | |
| 77 | + | |
| 78 | + //1、创建分享参数 | |
| 79 | + NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; | |
| 80 | + [shareParams SSDKSetupShareParamsByText:shareText images:shareImage url:[NSURL URLWithString:shareUrl] title:shareTitle type:SSDKContentTypeAuto]; | |
| 81 | + | |
| 82 | + //2、分享 | |
| 83 | + if (type == TemplateShareButtonTypeWeiXin){ | |
| 84 | + //微信 | |
| 85 | + [self startSharePlatform:SSDKPlatformTypeWechat parameters:shareParams]; | |
| 86 | + | |
| 87 | + } | |
| 88 | + else if (type == TemplateShareButtonTypePengYouQuan) { | |
| 89 | + //朋友圈 | |
| 90 | + [self startSharePlatform:SSDKPlatformSubTypeWechatTimeline parameters:shareParams]; | |
| 91 | + } | |
| 92 | + else if (type == TemplateShareButtonTypeXLWeiBo){ | |
| 93 | + //新浪微博 | |
| 94 | + [self startSharePlatform:SSDKPlatformTypeSinaWeibo parameters:shareParams]; | |
| 95 | + | |
| 96 | + } | |
| 97 | + else if (type == TemplateShareButtonTypeQQ){ | |
| 98 | ||
| 99 | + [self startSharePlatform:SSDKPlatformTypeQQ parameters:shareParams]; | |
| 100 | + | |
| 101 | + } | |
| 102 | + else if (type == TemplateShareButtonTypeQQZone){ | |
| 103 | + //qq空间 | |
| 104 | + [self startSharePlatform:SSDKPlatformSubTypeQZone parameters:shareParams]; | |
| 105 | + | |
| 106 | + } | |
| 107 | + | |
| 108 | +} | |
| 109 | +- (void)startSharePlatform:(SSDKPlatformType)platform parameters:(NSMutableDictionary *)parameters{ | |
| 110 | + | |
| 111 | + [ShareSDK share:platform parameters:parameters onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) { | |
| 112 | + | |
| 113 | + switch (state) { | |
| 114 | + case SSDKResponseStateSuccess: | |
| 115 | + { | |
| 116 | + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareSuccess") message:nil delegate:nil cancelButtonTitle:CustomStr(@"Sure") otherButtonTitles:nil]; | |
| 117 | + [alertView show]; | |
| 118 | + break; | |
| 119 | + } | |
| 120 | + case SSDKResponseStateFail: | |
| 121 | + { | |
| 122 | + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:CustomStr(@"ShareFailure") message:[NSString stringWithFormat:@"%@",error] delegate:nil cancelButtonTitle:CustomStr(@"Sure") otherButtonTitles:nil]; | |
| 123 | + [alertView show]; | |
| 124 | + break; | |
| 125 | + } | |
| 126 | + default: | |
| 127 | + break; | |
| 128 | + } | |
| 129 | + }]; | |
| 130 | +} | |
| 131 | +@end | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/XWShareView.h
0 → 100644
| 1 | +// | |
| 2 | +// XWShareView.h | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "TemplateShareButton.h" | |
| 11 | + | |
| 12 | +NS_ASSUME_NONNULL_BEGIN | |
| 13 | +@protocol XWShareViewDelegate <NSObject> | |
| 14 | + | |
| 15 | +@required | |
| 16 | + | |
| 17 | +- (void)shareBtnClickWithType:(TemplateShareButtonType)type andShareVC:(UIViewController *)shareVC; | |
| 18 | + | |
| 19 | +@end | |
| 20 | +@interface XWShareView : UIView | |
| 21 | + | |
| 22 | + | |
| 23 | +@property (nonatomic,weak) id<XWShareViewDelegate> shareDelegate; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * 自定义初始化方法 | |
| 27 | + * | |
| 28 | + * @param frame frame | |
| 29 | + * @param shareTitle reportButton是否隐藏 | |
| 30 | + * @param shareText reportButton是否隐藏 | |
| 31 | + * @param shareImg reportButton是否隐藏 | |
| 32 | + * @param shareUrl reportButton是否隐藏 | |
| 33 | + * | |
| 34 | + * @return 返回一个XWShareView对象 | |
| 35 | + */ | |
| 36 | + | |
| 37 | + | |
| 38 | +- (instancetype)initWithFrame:(CGRect)frame ShareImg:(NSString *)shareImg ShareTitle:(NSString *)shareTitle ShareText:(NSString *)shareText ShareUrl:(NSString *)shareUrl; | |
| 39 | + | |
| 40 | +- (void)show; | |
| 41 | + | |
| 42 | +- (void)configibutton; | |
| 43 | + | |
| 44 | +@end | |
| 45 | + | |
| 46 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveScioLive/Pages/Tools/ShareTool/XWShareView.m
0 → 100644
| 1 | +// | |
| 2 | +// XWShareView.m | |
| 3 | +// CNLiveScioLive | |
| 4 | +// | |
| 5 | +// Created by CNLive-zxw on 2018/10/20. | |
| 6 | +// Copyright © 2018年 CNLive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "XWShareView.h" | |
| 10 | +#import "TemplateShareManager.h" | |
| 11 | + | |
| 12 | + | |
| 13 | +@interface XWShareView (){ | |
| 14 | + UIToolbar *_toolBar; | |
| 15 | + | |
| 16 | + UIView *_contentView; | |
| 17 | + TemplateShareButton *_weiboButton; | |
| 18 | + TemplateShareButton *_weixinButton; | |
| 19 | + TemplateShareButton *_pengyouquanButton; | |
| 20 | + TemplateShareButton *_qqButton; | |
| 21 | + TemplateShareButton *_qqZoneButton; | |
| 22 | + TemplateShareButton *_txweiboButton; | |
| 23 | + TemplateShareButton *_xlweiboButton; | |
| 24 | + TemplateShareButton *_renrenButton; | |
| 25 | + TemplateShareButton *_reportButton; | |
| 26 | + | |
| 27 | + NSString *_title; | |
| 28 | + NSString *_shareText; | |
| 29 | + NSString *_shareImg; | |
| 30 | + NSString *_shareUrl; | |
| 31 | + BOOL _isShowing; | |
| 32 | + | |
| 33 | +} | |
| 34 | + | |
| 35 | +@end | |
| 36 | + | |
| 37 | +@implementation XWShareView | |
| 38 | + | |
| 39 | +- (instancetype)initWithFrame:(CGRect)frame ShareImg:(NSString *)shareImg ShareTitle:(NSString *)shareTitle ShareText:(NSString *)shareText ShareUrl:(NSString *)shareUrl{ | |
| 40 | + | |
| 41 | + self = [super initWithFrame:frame]; | |
| 42 | + if (self) { | |
| 43 | + _isShowing = YES; | |
| 44 | + _title = shareTitle; | |
| 45 | + _shareText = [self getZZwithString:shareText]; | |
| 46 | + _shareImg = shareImg; | |
| 47 | + _shareUrl = shareUrl; | |
| 48 | + | |
| 49 | + } | |
| 50 | + return self; | |
| 51 | + | |
| 52 | +} | |
| 53 | + | |
| 54 | +- (void)dealloc{ | |
| 55 | + NSLog(@"%s DESTROYED-----------",__func__); | |
| 56 | + | |
| 57 | +} | |
| 58 | + | |
| 59 | +- (void)layoutSubviews{ | |
| 60 | + [super layoutSubviews]; | |
| 61 | + | |
| 62 | +} | |
| 63 | + | |
| 64 | +#pragma mark -- Show Method | |
| 65 | +- (void)show{ | |
| 66 | + UIWindow *window = [UIApplication sharedApplication].keyWindow; | |
| 67 | + [window addSubview:self]; | |
| 68 | + [self mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 69 | + make.edges.equalTo(window); | |
| 70 | + }]; | |
| 71 | + | |
| 72 | + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(btnCancel)]; | |
| 73 | + [self addGestureRecognizer:tap]; | |
| 74 | + [self configibutton]; | |
| 75 | + | |
| 76 | +} | |
| 77 | +#pragma mark -- UI | |
| 78 | +- (void)configibutton{ | |
| 79 | + | |
| 80 | + self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3]; | |
| 81 | + | |
| 82 | + _contentView = [[UIView alloc]initWithFrame:CGRectMake(0, MainScreenHeight - 200, MainScreenWidth, 200)]; | |
| 83 | + _contentView.backgroundColor = [UIColor whiteColor]; | |
| 84 | + [self addSubview:_contentView]; | |
| 85 | + | |
| 86 | + UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(100, 15, MainScreenWidth - 200, 22)]; | |
| 87 | + title.textAlignment = NSTextAlignmentCenter; | |
| 88 | + title.text = @"分享到"; //@"分享到"; | |
| 89 | + title.font = Font(16); | |
| 90 | + [_contentView addSubview:title]; | |
| 91 | + | |
| 92 | + UIButton *close = [[UIButton alloc]initWithFrame:CGRectMake(MainScreenWidth - 44, 0, 44, 44)]; | |
| 93 | + [close setImage:[UIImage imageNamed:@"cnlive_icon"] forState:UIControlStateNormal]; | |
| 94 | + [close addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; | |
| 95 | + [_contentView addSubview:close]; | |
| 96 | + | |
| 97 | + CGFloat shareWH = 80, shareMarginS = (MainScreenWidth - 3 * shareWH)/4.0; | |
| 98 | + | |
| 99 | + //朋友圈 | |
| 100 | + _pengyouquanButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | |
| 101 | + _pengyouquanButton.frame = CGRectMake(shareMarginS, 80, 80, 80); | |
| 102 | + _pengyouquanButton.shareButtonType = TemplateShareButtonTypePengYouQuan; | |
| 103 | + _pengyouquanButton.image = @"朋友圈";//@"朋友圈"; | |
| 104 | + [_pengyouquanButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 105 | + [_contentView addSubview:_pengyouquanButton]; | |
| 106 | + | |
| 107 | + //微信 | |
| 108 | + _weixinButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | |
| 109 | + _weixinButton.frame = CGRectMake(2 * shareMarginS + shareWH, 80, 80, 80); | |
| 110 | + _weixinButton.shareButtonType = TemplateShareButtonTypeWeiXin; | |
| 111 | + _weixinButton.image = @"微信";//@"微信"; | |
| 112 | + [_weixinButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 113 | + [_contentView addSubview:_weixinButton]; | |
| 114 | + | |
| 115 | + //新浪微博 | |
| 116 | + _xlweiboButton = [TemplateShareButton buttonWithType:UIButtonTypeCustom]; | |
| 117 | + _xlweiboButton.frame = CGRectMake(3 * shareMarginS + 2 * shareWH, 80, 80, 80); | |
| 118 | + _xlweiboButton.shareButtonType = TemplateShareButtonTypeXLWeiBo; | |
| 119 | +// _xlweiboButton.image = CustomStr(@"Weibo");//@"新浪微博"; | |
| 120 | + _xlweiboButton.image = @"新浪微博";//@"新浪微博"; | |
| 121 | + [_xlweiboButton addTarget:self action:@selector(didClickShareButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 122 | + [_contentView addSubview:_xlweiboButton]; | |
| 123 | + | |
| 124 | +} | |
| 125 | + | |
| 126 | +//取消分享 | |
| 127 | +- (void)dismiss{ | |
| 128 | + [self removeFromSuperview]; | |
| 129 | +} | |
| 130 | + | |
| 131 | +#pragma mark -- Event Response | |
| 132 | +//取消分享 | |
| 133 | +- (void)btnCancel{ | |
| 134 | + [self removeFromSuperview]; | |
| 135 | + | |
| 136 | +} | |
| 137 | +- (void)didClickShareButtonAction:(TemplateShareButton *)button{ | |
| 138 | + [self dismiss]; | |
| 139 | + switch (button.shareButtonType) { | |
| 140 | + | |
| 141 | + case TemplateShareButtonTypePengYouQuan:case TemplateShareButtonTypeWeiXin: | |
| 142 | + if ([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi]){ | |
| 143 | + TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | |
| 144 | + [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | |
| 145 | + | |
| 146 | + } | |
| 147 | + else{ | |
| 148 | + //未安装微信 | |
| 149 | + | |
| 150 | + } | |
| 151 | + | |
| 152 | + break; | |
| 153 | + case TemplateShareButtonTypeXLWeiBo: | |
| 154 | + | |
| 155 | + if ([WeiboSDK isCanShareInWeiboAPP] || [WeiboSDK isCanSSOInWeiboApp]){ | |
| 156 | + TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | |
| 157 | + [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | |
| 158 | + | |
| 159 | + } | |
| 160 | + else{ | |
| 161 | + //未安装新浪微博 | |
| 162 | + | |
| 163 | + } | |
| 164 | + break; | |
| 165 | + | |
| 166 | + case TemplateShareButtonTypeQQ:case TemplateShareButtonTypeQQZone: | |
| 167 | + | |
| 168 | + if ([QQApiInterface isQQInstalled]){ | |
| 169 | + TemplateShareManager *manger = [TemplateShareManager shareSingleton]; | |
| 170 | + [manger shareType:button.shareButtonType shareImage:_shareImg shareTitle:_title shareText:_shareText shareUrl:_shareUrl]; | |
| 171 | + | |
| 172 | + } | |
| 173 | + else{ | |
| 174 | + //未安装qq | |
| 175 | + } | |
| 176 | + break; | |
| 177 | + | |
| 178 | + default: | |
| 179 | + break; | |
| 180 | + } | |
| 181 | + | |
| 182 | +} | |
| 183 | +#pragma mark - 去标签Tool | |
| 184 | +- (NSString *)getZZwithString:(NSString *)string{ | |
| 185 | + | |
| 186 | + if (!string || [string isEqualToString:@""] || [(NSNull *)string isEqual:[NSNull null]]) { | |
| 187 | + return @""; | |
| 188 | + } | |
| 189 | + | |
| 190 | + | |
| 191 | + NSRegularExpression *regularScriptExpretion=[NSRegularExpression regularExpressionWithPattern:@"<script[^>]*?>[\\s\\S]*?<\\/script>" | |
| 192 | + options:0 | |
| 193 | + error:nil]; | |
| 194 | + | |
| 195 | + string=[regularScriptExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + NSRegularExpression *regularExpretion=[NSRegularExpression regularExpressionWithPattern:@"<style[^>]*?>[\\s\\S]*?<\\/style>" | |
| 200 | + options:0 | |
| 201 | + error:nil]; | |
| 202 | + string=[regularExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + NSRegularExpression *regularHtmlExpretion=[NSRegularExpression regularExpressionWithPattern:@"<[^>]+>" | |
| 208 | + options:0 | |
| 209 | + error:nil]; | |
| 210 | + string=[regularHtmlExpretion stringByReplacingMatchesInString:string options:NSMatchingReportProgress range:NSMakeRange(0, string.length) withTemplate:@""]; | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + string = [string stringByReplacingOccurrencesOfString:@" " withString:@""]; // 过滤 等标签 | |
| 215 | + | |
| 216 | + return string; | |
| 217 | +} | |
| 218 | + | |
| 219 | +@end | ... | ... |
CNLiveScioLive/Pages/Tools/XWHTTPTool/XWHTTPTool.m
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | dispatch_once(&onceToken, ^{ |
| 21 | 21 | manager = [AFHTTPSessionManager manager]; |
| 22 | 22 | manager.responseSerializer = [AFJSONResponseSerializer serializer]; |
| 23 | - manager.requestSerializer=[AFHTTPRequestSerializer serializer]; | |
| 23 | + manager.requestSerializer = [AFHTTPRequestSerializer serializer]; | |
| 24 | 24 | manager.requestSerializer.timeoutInterval = 10; |
| 25 | 25 | manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html",@"text/plain",@"application/json",@"text/json",@"text/javascript", nil]; |
| 26 | 26 | }); | ... | ... |