Skip to content

Commit 155fe55

Browse files
committed
Banner
1 parent 26dc44d commit 155fe55

15 files changed

+692
-1
lines changed

Coding_iOS.xcodeproj/project.pbxproj

+48
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
4E0849831A918A7F00BD27F6 /* coding_emoji_41@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E08497D1A918A7F00BD27F6 /* coding_emoji_41@2x.png */; };
4848
4E0849841A918A7F00BD27F6 /* coding_emoji_42@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E08497E1A918A7F00BD27F6 /* coding_emoji_42@2x.png */; };
4949
4E0849851A918A7F00BD27F6 /* coding_emoji_43@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E08497F1A918A7F00BD27F6 /* coding_emoji_43@2x.png */; };
50+
4E095A591B690494008DC439 /* CodingBanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E095A581B690494008DC439 /* CodingBanner.m */; };
51+
4E095A5C1B6907AA008DC439 /* CodingBannersView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E095A5B1B6907AA008DC439 /* CodingBannersView.m */; };
52+
4E095A661B6909F9008DC439 /* AutoSlideScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E095A5F1B6909F9008DC439 /* AutoSlideScrollView.m */; };
53+
4E095A681B6909F9008DC439 /* NSTimer+Addition.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E095A631B6909F9008DC439 /* NSTimer+Addition.m */; };
54+
4E095A6D1B69F920008DC439 /* banner__page_selected@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E095A6B1B69F920008DC439 /* banner__page_selected@2x.png */; };
55+
4E095A6E1B69F920008DC439 /* banner__page_unselected@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4E095A6C1B69F920008DC439 /* banner__page_unselected@2x.png */; };
5056
4E15C7D01A26D2F000FB8DAD /* FolderToMoveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E15C7CF1A26D2F000FB8DAD /* FolderToMoveViewController.m */; };
5157
4E15C7D61A271A6300FB8DAD /* EaseToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E15C7D51A271A6300FB8DAD /* EaseToolBar.m */; };
5258
4E1A22821AB1729700CFC14F /* ProjectInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E1A22811AB1729700CFC14F /* ProjectInfoCell.m */; };
@@ -832,6 +838,16 @@
832838
4E08497D1A918A7F00BD27F6 /* coding_emoji_41@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "coding_emoji_41@2x.png"; sourceTree = "<group>"; };
833839
4E08497E1A918A7F00BD27F6 /* coding_emoji_42@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "coding_emoji_42@2x.png"; sourceTree = "<group>"; };
834840
4E08497F1A918A7F00BD27F6 /* coding_emoji_43@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "coding_emoji_43@2x.png"; sourceTree = "<group>"; };
841+
4E095A571B690494008DC439 /* CodingBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodingBanner.h; sourceTree = "<group>"; };
842+
4E095A581B690494008DC439 /* CodingBanner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodingBanner.m; sourceTree = "<group>"; };
843+
4E095A5A1B6907AA008DC439 /* CodingBannersView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodingBannersView.h; sourceTree = "<group>"; };
844+
4E095A5B1B6907AA008DC439 /* CodingBannersView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodingBannersView.m; sourceTree = "<group>"; };
845+
4E095A5E1B6909F9008DC439 /* AutoSlideScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoSlideScrollView.h; sourceTree = "<group>"; };
846+
4E095A5F1B6909F9008DC439 /* AutoSlideScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AutoSlideScrollView.m; sourceTree = "<group>"; };
847+
4E095A621B6909F9008DC439 /* NSTimer+Addition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+Addition.h"; sourceTree = "<group>"; };
848+
4E095A631B6909F9008DC439 /* NSTimer+Addition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+Addition.m"; sourceTree = "<group>"; };
849+
4E095A6B1B69F920008DC439 /* banner__page_selected@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "banner__page_selected@2x.png"; sourceTree = "<group>"; };
850+
4E095A6C1B69F920008DC439 /* banner__page_unselected@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "banner__page_unselected@2x.png"; sourceTree = "<group>"; };
835851
4E15C7CE1A26D2F000FB8DAD /* FolderToMoveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FolderToMoveViewController.h; sourceTree = "<group>"; };
836852
4E15C7CF1A26D2F000FB8DAD /* FolderToMoveViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FolderToMoveViewController.m; sourceTree = "<group>"; };
837853
4E15C7D41A271A6300FB8DAD /* EaseToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EaseToolBar.h; sourceTree = "<group>"; };
@@ -1974,6 +1990,26 @@
19741990
/* End PBXFrameworksBuildPhase section */
19751991

19761992
/* Begin PBXGroup section */
1993+
4E095A5D1B6909F9008DC439 /* AutoSlideScrollView */ = {
1994+
isa = PBXGroup;
1995+
children = (
1996+
4E095A5E1B6909F9008DC439 /* AutoSlideScrollView.h */,
1997+
4E095A5F1B6909F9008DC439 /* AutoSlideScrollView.m */,
1998+
4E095A621B6909F9008DC439 /* NSTimer+Addition.h */,
1999+
4E095A631B6909F9008DC439 /* NSTimer+Addition.m */,
2000+
);
2001+
path = AutoSlideScrollView;
2002+
sourceTree = "<group>";
2003+
};
2004+
4E095A6A1B69F920008DC439 /* banner */ = {
2005+
isa = PBXGroup;
2006+
children = (
2007+
4E095A6B1B69F920008DC439 /* banner__page_selected@2x.png */,
2008+
4E095A6C1B69F920008DC439 /* banner__page_unselected@2x.png */,
2009+
);
2010+
path = banner;
2011+
sourceTree = "<group>";
2012+
};
19772013
4E1A228C1AB19D1F00CFC14F /* git_btn_icons */ = {
19782014
isa = PBXGroup;
19792015
children = (
@@ -3224,6 +3260,7 @@
32243260
8EA6CF5D19E240C40076D59C /* Images */ = {
32253261
isa = PBXGroup;
32263262
children = (
3263+
4E095A6A1B69F920008DC439 /* banner */,
32273264
4E94C5021B4D334B00EB668A /* pop_icon */,
32283265
4EF17E761B3BF320003CDD2D /* introduction */,
32293266
4EC461AE1B39360F00D08970 /* file_changeType */,
@@ -3508,6 +3545,8 @@
35083545
4E4D6AA21B1DB63A00FD2E49 /* FileLineChange.m */,
35093546
4E4D6AB01B21A96100FD2E49 /* Commits.h */,
35103547
4E4D6AB11B21A96100FD2E49 /* Commits.m */,
3548+
4E095A571B690494008DC439 /* CodingBanner.h */,
3549+
4E095A581B690494008DC439 /* CodingBanner.m */,
35113550
);
35123551
path = Models;
35133552
sourceTree = "<group>";
@@ -3581,6 +3620,7 @@
35813620
8EA6D03E19E240C40076D59C /* Vendor */ = {
35823621
isa = PBXGroup;
35833622
children = (
3623+
4E095A5D1B6909F9008DC439 /* AutoSlideScrollView */,
35843624
4E94C50F1B4E0C0300EB668A /* XHRealTimeBlur */,
35853625
4E94C4F51B4D2B9300EB668A /* PopMenu */,
35863626
4E53EB4C1AF9CC520034FE1C /* RKSwipeBetweenViewControllers */,
@@ -3688,6 +3728,8 @@
36883728
4EDC33CD1AFB4DCC00698315 /* EaseInputTipsView.m */,
36893729
4EE1A2341B5DF568004284F1 /* ProjectTagLabel.h */,
36903730
4EE1A2351B5DF568004284F1 /* ProjectTagLabel.m */,
3731+
4E095A5A1B6907AA008DC439 /* CodingBannersView.h */,
3732+
4E095A5B1B6907AA008DC439 /* CodingBannersView.m */,
36913733
);
36923734
path = Views;
36933735
sourceTree = "<group>";
@@ -4007,6 +4049,7 @@
40074049
8EA6D1A819E240C40076D59C /* xtsegment_bordor_left@2x.png in Resources */,
40084050
8EA6D18C19E240C40076D59C /* tweet_selected@2x.png in Resources */,
40094051
8E525C8A19F7E3F800496B34 /* blankpage_image_loadFail@2x.png in Resources */,
4052+
4E095A6E1B69F920008DC439 /* banner__page_unselected@2x.png in Resources */,
40104053
4E96E7D81A1B537E0037C098 /* icon_file_ai@2x.png in Resources */,
40114054
8E525C8919F7E3F800496B34 /* blankpage_button_reload@2x.png in Resources */,
40124055
8E97CEAC1A0C7E26006F9AD7 /* coding_emoji_21@2x.png in Resources */,
@@ -4280,6 +4323,7 @@
42804323
4EFE8DAD1B394A0D004B7559 /* file_changeType_RENAME@2x.png in Resources */,
42814324
B9A00D7F1ACA3A05008BA008 /* ProjectSetting.storyboard in Resources */,
42824325
8EA6D19219E240C40076D59C /* timeline_icon_unread@2x.png in Resources */,
4326+
4E095A6D1B69F920008DC439 /* banner__page_selected@2x.png in Resources */,
42834327
4E217F141A70EDC700F6DF88 /* SVWebViewControllerActivitySafari-iPad@2x.png in Resources */,
42844328
4E5A66991B26EB210007A0AD /* diff.html in Resources */,
42854329
4EF91F641B00B62B0021C951 /* icon_not_locationed@2x.png in Resources */,
@@ -4486,6 +4530,7 @@
44864530
4E6BA2DF1A1EE6AF005FD721 /* AFURLRequestSerialization.m in Sources */,
44874531
8EA6D1CD19E240C40076D59C /* UIUnderlinedButton.m in Sources */,
44884532
4E5F39021AC951060010515D /* TaskCommentCCell.m in Sources */,
4533+
4E095A661B6909F9008DC439 /* AutoSlideScrollView.m in Sources */,
44894534
4ECE8AD91A3943E80021E29C /* UIViewController+DownMenu.m in Sources */,
44904535
4E94C5011B4D2B9300EB668A /* PopMenu.m in Sources */,
44914536
8EA6D13019E240C40076D59C /* LikersViewController.m in Sources */,
@@ -4536,9 +4581,11 @@
45364581
0A27A05D1AB5A13B00067833 /* TweetSendLocationDetailViewController.m in Sources */,
45374582
0AB591B01AB6D6BE0076C454 /* TweetSendMapAnnotation.m in Sources */,
45384583
4ECF70491B185BCC000280FF /* MRPR.m in Sources */,
4584+
4E095A5C1B6907AA008DC439 /* CodingBannersView.m in Sources */,
45394585
4E8D5D661B45306900B70936 /* OTPListViewController.m in Sources */,
45404586
4EA7F1651A6D192B00A046BD /* UIImageView+WebCache.m in Sources */,
45414587
8EF643B819FF7E2900F7EEB0 /* InputOnlyTextPlainCell.m in Sources */,
4588+
4E095A681B6909F9008DC439 /* NSTimer+Addition.m in Sources */,
45424589
4E6BA2DB1A1EE6AF005FD721 /* AFURLSessionManager.m in Sources */,
45434590
8E1C3DEE19E7D58A00EF3032 /* ActionSheetLocalePicker.m in Sources */,
45444591
4ECE8AE91A3943E80021E29C /* UIViewController+Swizzle.m in Sources */,
@@ -4655,6 +4702,7 @@
46554702
8EA6D1B819E240C40076D59C /* PrivateMessages.m in Sources */,
46564703
8E64ED7F19ED0CE3006E99DA /* QBAssetsCollectionViewCell.m in Sources */,
46574704
4E6D718A1A75F00E005AD988 /* YLImageView.m in Sources */,
4705+
4E095A591B690494008DC439 /* CodingBanner.m in Sources */,
46584706
8EA6D1C119E240C40076D59C /* Tweets.m in Sources */,
46594707
4E8D5D5F1B45295D00B70936 /* OTPAuthURL.m in Sources */,
46604708
8EA6D1F619E240C40076D59C /* MJPhoto.m in Sources */,

Coding_iOS/Controllers/EditLabelViewController.m

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
148148
if (indexPath.section == 0) {
149149
EditLabelHeadCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_EditLabelHeadCell forIndexPath:indexPath];
150150
[cell.addBtn addTarget:self action:@selector(addBtnClick:) forControlEvents:UIControlEventTouchUpInside];
151+
cell.labelField.text = self.tagNameToAdd;
151152
cell.labelField.delegate = self;
152153
[cell.labelField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
153154
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];

Coding_iOS/Controllers/RootControllers/Tweet_RootViewController.m

+42-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#import "SVPullToRefresh.h"
2424
#import "WebViewController.h"
2525
#import "TweetSendLocationDetailViewController.h"
26+
#import "CodingBannersView.h"
2627

2728
@interface Tweet_RootViewController ()
2829
{
@@ -43,6 +44,9 @@ @interface Tweet_RootViewController ()
4344
//删冒泡
4445
@property (strong, nonatomic) Tweet *deleteTweet;
4546
@property (nonatomic, assign) NSInteger deleteTweetsIndex;
47+
48+
//Banner
49+
@property (strong, nonatomic) CodingBannersView *myBannersView;
4650
@end
4751

4852
@implementation Tweet_RootViewController
@@ -125,7 +129,6 @@ - (void)viewDidLoad
125129
//评论
126130
_myMsgInputView = [UIMessageInputView messageInputViewWithType:UIMessageInputViewContentTypeTweet];
127131
_myMsgInputView.delegate = self;
128-
129132
}
130133

131134
- (void)viewWillDisappear:(BOOL)animated{
@@ -152,6 +155,43 @@ - (void)didReceiveMemoryWarning
152155
[super didReceiveMemoryWarning];
153156
// Dispose of any resources that can be recreated.
154157
}
158+
159+
#pragma mark Banner
160+
161+
- (void)refreshBanner{
162+
if (self.curIndex != Tweet_RootViewControllerTypeAll) {
163+
return;
164+
}
165+
__weak typeof(self) weakSelf = self;
166+
if (!_myBannersView) {
167+
_myBannersView = [CodingBannersView new];
168+
_myBannersView.tapActionBlock = ^(CodingBanner *tapedBanner){
169+
[weakSelf goToBanner:tapedBanner];
170+
NSLog(@"%@", tapedBanner);
171+
};
172+
_myTableView.tableHeaderView = _myBannersView;
173+
}
174+
// {
175+
// CodingBanner *tempB = [CodingBanner new];
176+
// tempB.id = @(3);
177+
// tempB.title = @"码市--技术变现,让赚钱更简单!";
178+
// tempB.image = @"https://dn-coding-net-production-static.qbox.me/985223b8-39fb-4553-a949-ec0fd1cb01f2.png";
179+
// tempB.link = @"https://mart.coding.net/";
180+
// tempB.name = @"码市";
181+
// _myBannersView.curBannerList = @[tempB, tempB];
182+
// }
183+
[[Coding_NetAPIManager sharedManager] request_BannersWithBlock:^(id data, NSError *error) {
184+
if (data) {
185+
weakSelf.myBannersView.curBannerList = data;
186+
}
187+
}];
188+
}
189+
190+
- (void)goToBanner:(CodingBanner *)tapedBanner{
191+
WebViewController *vc = [WebViewController webVCWithUrlStr:tapedBanner.link];
192+
[self.navigationController pushViewController:vc animated:YES];
193+
}
194+
155195
#pragma mark UIMessageInputViewDelegate
156196
- (void)messageInputView:(UIMessageInputView *)inputView sendText:(NSString *)text{
157197
[self sendCommentMessage:text];
@@ -272,6 +312,7 @@ - (void)refresh{
272312
}
273313
curTweets.willLoadMore = NO;
274314
[self sendRequest];
315+
[self refreshBanner];
275316
}
276317

277318
- (void)refreshMore{
Loading
Loading

Coding_iOS/Models/CodingBanner.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// CodingBanner.h
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/7/29.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface CodingBanner : NSObject
12+
@property (strong, nonatomic) NSNumber *id, *status;
13+
@property (strong, nonatomic) NSString *title, *image, *link, *name;
14+
@end

Coding_iOS/Models/CodingBanner.m

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// CodingBanner.m
3+
// Coding_iOS
4+
//
5+
// Created by Ease on 15/7/29.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "CodingBanner.h"
10+
11+
@implementation CodingBanner
12+
13+
@end

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#import "CommitInfo.h"
3232
#import "Commits.h"
3333
#import "ProjectTag.h"
34+
#import "CodingBanner.h"
3435

3536
typedef NS_ENUM(NSUInteger, VerifyType){
3637
VerifyTypeUnknow = 0,
@@ -201,4 +202,6 @@ typedef NS_ENUM(NSUInteger, VerifyType){
201202
- (void)request_Users_WithSearchString:(NSString *)searchStr andBlock:(void (^)(id data, NSError *error))block;
202203
- (void)request_MDHtmlStr_WithMDStr:(NSString *)mdStr inProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block;
203204
- (void)request_VerifyTypeWithBlock:(void (^)(VerifyType type, NSError *error))block;
205+
- (void)request_BannersWithBlock:(void (^)(id data, NSError *error))block;
206+
204207
@end

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

+12
Original file line numberDiff line numberDiff line change
@@ -1916,4 +1916,16 @@ - (void)request_VerifyTypeWithBlock:(void (^)(VerifyType type, NSError *error))b
19161916
}
19171917
}];
19181918
}
1919+
- (void)request_BannersWithBlock:(void (^)(id data, NSError *error))block{
1920+
[MobClick event:kUmeng_Event_Request label:@"Banner"];
1921+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/banner/type/app" withParams:nil withMethodType:Get autoShowError:NO andBlock:^(id data, NSError *error) {
1922+
if (data) {
1923+
data = [data valueForKey:@"data"];
1924+
NSArray *resultA = [NSArray arrayFromJSON:data ofObjects:@"CodingBanner"];
1925+
block(resultA, nil);
1926+
}else{
1927+
block(nil, error);
1928+
}
1929+
}];
1930+
}
19191931
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// AutoSlideScrollView.h
3+
// AutoSlideScrollViewDemo
4+
//
5+
// Created by Mike Chen on 14-1-23.
6+
// Copyright (c) 2014年 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface AutoSlideScrollView : UIView
12+
13+
@property (nonatomic , readonly) UIScrollView *scrollView;
14+
@property (nonatomic , assign, readonly) NSInteger currentPageIndex;
15+
16+
/**
17+
* 初始化
18+
*
19+
* @param frame frame
20+
* @param animationDuration 自动滚动的间隔时长。如果<=0,不自动滚动。
21+
*
22+
* @return instance
23+
*/
24+
- (id)initWithFrame:(CGRect)frame animationDuration:(NSTimeInterval)animationDuration;
25+
26+
- (void)reloadData;
27+
28+
/**
29+
数据源:获取总的page个数,如果少于2个,不自动滚动
30+
**/
31+
@property (nonatomic , copy) NSInteger (^totalPagesCount)();
32+
33+
/**
34+
数据源:获取第pageIndex个位置的contentView
35+
**/
36+
@property (nonatomic , copy) UIView *(^fetchContentViewAtIndex)(NSInteger pageIndex);
37+
38+
/**
39+
当点击的时候,执行的block
40+
**/
41+
@property (nonatomic , copy) void (^tapActionBlock)(NSInteger pageIndex);
42+
43+
/**
44+
当currentPageIndex改变的时候,执行的block
45+
**/
46+
@property (nonatomic , copy) void (^currentPageIndexChangeBlock)(NSInteger currentPageIndex);
47+
48+
@end

0 commit comments

Comments
 (0)