Banner · chenddcoder/Coding-iOS@155fe55 · GitHub
Skip to content

Commit 155fe55

Browse files
committed
Banner
1 parent 26dc44d commit 155fe55

15 files changed

Lines changed: 692 additions & 1 deletion

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 48 additions & 0 deletions

Coding_iOS/Controllers/EditLabelViewController.m

Lines changed: 1 addition & 0 deletions
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

Lines changed: 42 additions & 1 deletion
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{
123 Bytes
Loading
112 Bytes
Loading

Coding_iOS/Models/CodingBanner.h

Lines changed: 14 additions & 0 deletions
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

Lines changed: 13 additions & 0 deletions
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 12 additions & 0 deletions
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
Lines changed: 48 additions & 0 deletions

0 commit comments

Comments
 (0)