Skip to content

Commit abccddf

Browse files
author
panshiyu
committed
11
1 parent db866f9 commit abccddf

18 files changed

Lines changed: 525 additions & 39 deletions

.DS_Store

-4 KB
Binary file not shown.

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,11 @@
765765
B9A00D821ACA3A17008BA008 /* ProjectSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D811ACA3A17008BA008 /* ProjectSettingViewController.m */; };
766766
B9A00D851ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A00D841ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m */; };
767767
E7A046A01A47279E00528C12 /* Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = E7A0469F1A47279E00528C12 /* Helper.m */; };
768+
FE4CB4381B61881C0041E9EF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = FE4CB4371B61881C0041E9EF /* [email protected] */; };
769+
FE4CB43B1B618A6A0041E9EF /* CSTopicDetailVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB43A1B618A6A0041E9EF /* CSTopicDetailVC.m */; };
770+
FE4CB43D1B618EDC0041E9EF /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = FE4CB43C1B618EDC0041E9EF /* [email protected] */; };
771+
FE4CB4401B6194D10041E9EF /* CSTopiclistView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */; };
772+
FE4CB4431B619D280041E9EF /* Topic.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4CB4421B619D280041E9EF /* Topic.m */; };
768773
FEC419251B53A39B00C498F5 /* CSSearchVC.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC419241B53A39B00C498F5 /* CSSearchVC.m */; };
769774
FEC419281B53A92600C498F5 /* CSSearchModel.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC419271B53A92600C498F5 /* CSSearchModel.m */; };
770775
FEC4192B1B53A9E300C498F5 /* TMCacheExtend.m in Sources */ = {isa = PBXBuildFile; fileRef = FEC4192A1B53A9E300C498F5 /* TMCacheExtend.m */; };
@@ -1949,6 +1954,14 @@
19491954
C613B8719C3D38FED828A1E2 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
19501955
E7A0469E1A47279E00528C12 /* Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Helper.h; sourceTree = "<group>"; };
19511956
E7A0469F1A47279E00528C12 /* Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Helper.m; sourceTree = "<group>"; };
1957+
FE4CB4371B61881C0041E9EF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
1958+
FE4CB4391B618A6A0041E9EF /* CSTopicDetailVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSTopicDetailVC.h; sourceTree = "<group>"; };
1959+
FE4CB43A1B618A6A0041E9EF /* CSTopicDetailVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSTopicDetailVC.m; sourceTree = "<group>"; };
1960+
FE4CB43C1B618EDC0041E9EF /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
1961+
FE4CB43E1B6194D10041E9EF /* CSTopiclistView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSTopiclistView.h; sourceTree = "<group>"; };
1962+
FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSTopiclistView.m; sourceTree = "<group>"; };
1963+
FE4CB4411B619D280041E9EF /* Topic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Topic.h; sourceTree = "<group>"; };
1964+
FE4CB4421B619D280041E9EF /* Topic.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Topic.m; sourceTree = "<group>"; };
19521965
FEC419231B53A39B00C498F5 /* CSSearchVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSearchVC.h; sourceTree = "<group>"; };
19531966
FEC419241B53A39B00C498F5 /* CSSearchVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSSearchVC.m; sourceTree = "<group>"; };
19541967
FEC419261B53A92600C498F5 /* CSSearchModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSearchModel.h; sourceTree = "<group>"; };
@@ -2511,6 +2524,7 @@
25112524
4E996BFF1ABBF56A00C704F1 /* [email protected] */,
25122525
4E996C001ABBF56A00C704F1 /* [email protected] */,
25132526
4E996C011ABBF56A00C704F1 /* [email protected] */,
2527+
FE4CB43C1B618EDC0041E9EF /* [email protected] */,
25142528
);
25152529
path = userInfo;
25162530
sourceTree = "<group>";
@@ -3026,6 +3040,7 @@
30263040
isa = PBXGroup;
30273041
children = (
30283042
4E5F39061ACBFDCD0010515D /* [email protected] */,
3043+
FE4CB4371B61881C0041E9EF /* [email protected] */,
30293044
8E97CE6B1A0B243B006F9AD7 /* [email protected] */,
30303045
8E97CE571A0A3424006F9AD7 /* [email protected] */,
30313046
8E97CE581A0A3424006F9AD7 /* [email protected] */,
@@ -3508,6 +3523,8 @@
35083523
8EA6CFF319E240C40076D59C /* Tweets.m */,
35093524
4ECD72ED1AAD7EC300D69AE1 /* Tweet.h */,
35103525
4ECD72EE1AAD7EC300D69AE1 /* Tweet.m */,
3526+
FE4CB4411B619D280041E9EF /* Topic.h */,
3527+
FE4CB4421B619D280041E9EF /* Topic.m */,
35113528
8EA6CFF619E240C40076D59C /* User.h */,
35123529
8EA6CFF719E240C40076D59C /* User.m */,
35133530
8EA6CFF819E240C40076D59C /* Users.h */,
@@ -3979,6 +3996,10 @@
39793996
FEF35ECF1B56C2870000280F /* CSScrollview.m */,
39803997
FEF35EE11B5839090000280F /* CSTopicCreateVC.h */,
39813998
FEF35EE21B5839090000280F /* CSTopicCreateVC.m */,
3999+
FE4CB4391B618A6A0041E9EF /* CSTopicDetailVC.h */,
4000+
FE4CB43A1B618A6A0041E9EF /* CSTopicDetailVC.m */,
4001+
FE4CB43E1B6194D10041E9EF /* CSTopiclistView.h */,
4002+
FE4CB43F1B6194D10041E9EF /* CSTopiclistView.m */,
39824003
);
39834004
path = Topic;
39844005
sourceTree = "<group>";
@@ -4100,6 +4121,7 @@
41004121
8E8F7B3519EF6306006BA8BD /* [email protected] in Resources */,
41014122
4ED558321B4FA68400FC10CB /* [email protected] in Resources */,
41024123
4E0849801A918A7F00BD27F6 /* [email protected] in Resources */,
4124+
FE4CB4381B61881C0041E9EF /* [email protected] in Resources */,
41034125
8E97CE661A0A3424006F9AD7 /* [email protected] in Resources */,
41044126
4EED9DCC1B539366000E5827 /* [email protected] in Resources */,
41054127
4EC461B71B3939DC00D08970 /* [email protected] in Resources */,
@@ -4151,6 +4173,7 @@
41514173
8E97CE9F1A0C7E26006F9AD7 /* [email protected] in Resources */,
41524174
4E6383E51B3272CF00D98648 /* [email protected] in Resources */,
41534175
0A782FDE1AB5B78B00E96661 /* TweetSendCreateLocationCell.xib in Resources */,
4176+
FE4CB43D1B618EDC0041E9EF /* [email protected] in Resources */,
41544177
8E8F7B3219EF6306006BA8BD /* [email protected] in Resources */,
41554178
8E97CEBB1A0C7E26006F9AD7 /* [email protected] in Resources */,
41564179
8EA6D19F19E240C40076D59C /* [email protected] in Resources */,
@@ -4609,6 +4632,7 @@
46094632
0AB591B01AB6D6BE0076C454 /* TweetSendMapAnnotation.m in Sources */,
46104633
FEF35ECD1B56A8B70000280F /* CSTopicModel.m in Sources */,
46114634
4ECF70491B185BCC000280FF /* MRPR.m in Sources */,
4635+
FE4CB4401B6194D10041E9EF /* CSTopiclistView.m in Sources */,
46124636
4E8D5D661B45306900B70936 /* OTPListViewController.m in Sources */,
46134637
4EA7F1651A6D192B00A046BD /* UIImageView+WebCache.m in Sources */,
46144638
8EF643B819FF7E2900F7EEB0 /* InputOnlyTextPlainCell.m in Sources */,
@@ -4644,6 +4668,7 @@
46444668
4E996BDC1ABA79AB00C704F1 /* UserInfoDetailViewController.m in Sources */,
46454669
B9A00D851ACA3A55008BA008 /* ProjectAdvancedSettingViewController.m in Sources */,
46464670
4E8765671A22E5B40090CFB9 /* SWLongPressGestureRecognizer.m in Sources */,
4671+
FE4CB43B1B618A6A0041E9EF /* CSTopicDetailVC.m in Sources */,
46474672
0AB591AC1AB6D2F60076C454 /* TweetSendLocaitonMapViewController.m in Sources */,
46484673
4EA7F1611A6D192B00A046BD /* UIButton+WebCache.m in Sources */,
46494674
8EE72BE419E3F2E8002C11D9 /* SDWebImageManager+MJ.m in Sources */,
@@ -4680,6 +4705,7 @@
46804705
4E6BA2D91A1EE6AF005FD721 /* AFURLConnectionOperation.m in Sources */,
46814706
8EA6D1BB19E240C40076D59C /* ProjectTopic.m in Sources */,
46824707
8EA6D13219E240C40076D59C /* RegisterViewController.m in Sources */,
4708+
FE4CB4431B619D280041E9EF /* Topic.m in Sources */,
46834709
8EF643C519FF7E2900F7EEB0 /* TitleRImageMoreCell.m in Sources */,
46844710
4E217F151A70EDC700F6DF88 /* SVWebViewControllerActivitySafari.m in Sources */,
46854711
4E8D5D5A1B45295D00B70936 /* HOTPGenerator.m in Sources */,

Coding_iOS/Controllers/Search/CSSearchCell.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
9696

9797
if(!self.tweetLikeIconView) {
9898
self.tweetLikeIconView = [[UIImageView alloc] initWithFrame:CGRectMake(kTweetCell_PadingLeft, 0, 12, 12)];
99+
//TODO psy 需要like icon
99100
self.tweetLikeIconView.image = [UIImage imageNamed:@"time_clock_icon"];
100101
[self.contentView addSubview:self.tweetLikeIconView];
101102
}

Coding_iOS/Controllers/Topic/CSMyTopicVC.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
//
88

99
#import <UIKit/UIKit.h>
10-
11-
@interface CSMyTopicVC : UIViewController
12-
10+
#import "BaseViewController.h"
11+
#import "XTSegmentControl.h"
12+
#import "iCarousel.h"
13+
#import "User.h"
14+
@interface CSMyTopicVC : BaseViewController<iCarouselDataSource, iCarouselDelegate>
15+
@property (strong, nonatomic) NSArray *segmentItems;
16+
@property (strong, nonatomic) User *curUser;
1317
@end

Coding_iOS/Controllers/Topic/CSMyTopicVC.m

Lines changed: 112 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,21 @@
77
//
88

99
#import "CSMyTopicVC.h"
10-
#import "XTSegmentControl.h"
11-
#import "iCarousel.h"
10+
#import "Topic.h"
11+
12+
#import "Login.h"
13+
14+
#import "Coding_NetAPIManager.h"
15+
16+
#import "CSTopiclistView.h"
17+
#import "CSTopicDetailVC.h"
1218

1319
@interface CSMyTopicVC ()
1420
@property (strong, nonatomic) XTSegmentControl *mySegmentControl;
1521
@property (strong, nonatomic) iCarousel *myCarousel;
22+
@property (assign, nonatomic) NSInteger oldSelectedIndex;
23+
24+
@property (strong, nonatomic) NSMutableDictionary *myTopicsDict;
1625
@end
1726

1827
@implementation CSMyTopicVC
@@ -21,39 +30,114 @@ - (void)viewDidLoad {
2130
[super viewDidLoad];
2231

2332
self.view.backgroundColor = [UIColor whiteColor];
24-
// self.segmentItems = @[@"我参与的", @"我收藏的"];
33+
34+
self.segmentItems = @[@"我关注的", @"我参与的"];
35+
self.title = @"我的话题";
36+
_myTopicsDict = [[NSMutableDictionary alloc] initWithCapacity:_segmentItems.count];
37+
_oldSelectedIndex = 0;
2538

2639
//添加myCarousel
27-
// _myCarousel = ({
28-
// iCarousel *icarousel = [[iCarousel alloc] init];
29-
// icarousel.dataSource = self;
30-
// icarousel.delegate = self;
31-
// icarousel.decelerationRate = 1.0;
32-
// icarousel.scrollSpeed = 1.0;
33-
// icarousel.type = iCarouselTypeLinear;
34-
// icarousel.pagingEnabled = YES;
35-
// icarousel.clipsToBounds = YES;
36-
// icarousel.bounceDistance = 0.2;
37-
// [self.view addSubview:icarousel];
38-
// [icarousel mas_makeConstraints:^(MASConstraintMaker *make) {
39-
// make.edges.equalTo(self.view).insets(UIEdgeInsetsMake(kMySegmentControl_Height, 0, 0, 0));
40-
// }];
41-
// icarousel;
42-
// });
40+
_myCarousel = ({
41+
iCarousel *icarousel = [[iCarousel alloc] init];
42+
icarousel.dataSource = self;
43+
icarousel.delegate = self;
44+
icarousel.decelerationRate = 1.0;
45+
icarousel.scrollSpeed = 1.0;
46+
icarousel.type = iCarouselTypeLinear;
47+
icarousel.pagingEnabled = YES;
48+
icarousel.clipsToBounds = YES;
49+
icarousel.bounceDistance = 0.2;
50+
[self.view addSubview:icarousel];
51+
[icarousel mas_makeConstraints:^(MASConstraintMaker *make) {
52+
make.edges.equalTo(self.view).insets(UIEdgeInsetsMake(kMySegmentControl_Height, 0, 0, 0));
53+
}];
54+
icarousel;
55+
});
4356

4457
//添加滑块
45-
// __weak typeof(_myCarousel) weakCarousel = _myCarousel;
46-
// _mySegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height) Items:_segmentItems selectedBlock:^(NSInteger index) {
47-
// if (index == _oldSelectedIndex) {
48-
// return;
58+
__weak typeof(_myCarousel) weakCarousel = _myCarousel;
59+
_mySegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height) Items:_segmentItems selectedBlock:^(NSInteger index) {
60+
if (index == _oldSelectedIndex) {
61+
return;
62+
}
63+
[weakCarousel scrollToItemAtIndex:index animated:NO];
64+
}];
65+
[self.view addSubview:_mySegmentControl];
66+
_myCarousel.scrollEnabled = NO;
67+
68+
}
69+
70+
- (void)viewWillAppear:(BOOL)animated{
71+
[super viewWillAppear:animated];
72+
if (_myCarousel) {
73+
// ProjectListView *listView = (ProjectListView *)_myCarousel.currentItemView;
74+
// if (listView) {
75+
// [listView refreshToQueryData];
4976
// }
50-
// [weakCarousel scrollToItemAtIndex:index animated:NO];
51-
// }];
52-
// [self.view addSubview:_mySegmentControl];
53-
// [self setupNavBtn];
54-
// self.icarouselScrollEnabled = NO;
77+
}
78+
}
79+
80+
#pragma mark iCarousel M
81+
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel{
82+
return _segmentItems.count;
83+
}
84+
85+
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{
86+
Projects *curPros = [_myTopicsDict objectForKey:[NSNumber numberWithUnsignedInteger:index]];
87+
if (!curPros) {
88+
curPros = [self projectsWithIndex:index];
89+
[_myTopicsDict setObject:curPros forKey:[NSNumber numberWithUnsignedInteger:index]];
90+
}
91+
CSTopiclistView *listView = (CSTopiclistView *)view;
92+
if (listView) {
93+
[listView setTopics:curPros];
94+
}else{
95+
__weak typeof(self) *weakSelf = self;
96+
listView = [[CSTopiclistView alloc] initWithFrame:carousel.bounds topics:curPros block:^(Project *project) {
97+
[weakSelf goToProject:project];
98+
DebugLog(@"\n=====%@", project.name);
99+
} tabBarHeight:CGRectGetHeight(self.rdv_tabBarController.tabBar.frame)];
100+
}
101+
[listView setSubScrollsToTop:(index == carousel.currentItemIndex)];
102+
return listView;
103+
}
104+
105+
- (Projects *)projectsWithIndex:(NSUInteger)index{
106+
return [Projects projectsWithType:index andUser:nil];
107+
}
55108

109+
- (void)carouselDidScroll:(iCarousel *)carousel{
110+
[self.view endEditing:YES];
111+
if (_mySegmentControl) {
112+
float offset = carousel.scrollOffset;
113+
if (offset > 0) {
114+
[_mySegmentControl moveIndexWithProgress:offset];
115+
}
116+
}
56117
}
57118

119+
- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel
120+
{
121+
if (_mySegmentControl) {
122+
_mySegmentControl.currentIndex = carousel.currentItemIndex;
123+
}
124+
if (_oldSelectedIndex != carousel.currentItemIndex) {
125+
_oldSelectedIndex = carousel.currentItemIndex;
126+
CSTopiclistView *curView = (CSTopiclistView *)carousel.currentItemView;
127+
[curView refreshToQueryData];
128+
}
129+
[carousel.visibleItemViews enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) {
130+
[obj setSubScrollsToTop:(obj == carousel.currentItemView)];
131+
}];
132+
}
133+
134+
135+
#pragma mark -
136+
137+
- (void)goToTopic:(Topic*)topic{
138+
CSTopicDetailVC *vc = [[CSTopicDetailVC alloc] init];
139+
vc.topic = topic;
140+
[self.navigationController pushViewController:vc animated:YES];
141+
}
58142

59143
@end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CSTopicDetailVC.h
3+
// Coding_iOS
4+
//
5+
// Created by pan Shiyu on 15/7/24.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import "Topic.h"
11+
12+
@interface CSTopicDetailVC : UIViewController
13+
14+
@property (nonatomic,strong)Topic *topic;
15+
16+
@end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// CSTopicDetailVC.m
3+
// Coding_iOS
4+
//
5+
// Created by pan Shiyu on 15/7/24.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import "CSTopicDetailVC.h"
10+
11+
@interface CSTopicDetailVC ()
12+
13+
@end
14+
15+
@implementation CSTopicDetailVC
16+
17+
18+
19+
- (void)viewDidLoad {
20+
[super viewDidLoad];
21+
// Do any additional setup after loading the view.
22+
}
23+
24+
- (void)didReceiveMemoryWarning {
25+
[super didReceiveMemoryWarning];
26+
// Dispose of any resources that can be recreated.
27+
}
28+
29+
/*
30+
#pragma mark - Navigation
31+
32+
// In a storyboard-based application, you will often want to do a little preparation before navigation
33+
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
34+
// Get the new view controller using [segue destinationViewController].
35+
// Pass the selected object to the new view controller.
36+
}
37+
*/
38+
39+
@end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// CSTopiclistView.h
3+
// Coding_iOS
4+
//
5+
// Created by pan Shiyu on 15/7/24.
6+
// Copyright (c) 2015年 Coding. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#import "SWTableViewCell.h"
11+
typedef void(^TopicListViewBlock)(id topic);
12+
13+
@interface CSTopiclistView : UIView<UITableViewDataSource, UITableViewDelegate>
14+
15+
- (id)initWithFrame:(CGRect)frame topics:(id )topic block:(TopicListViewBlock)block tabBarHeight:(CGFloat)tabBarHeight;
16+
- (void)setTopics:(id )topics;
17+
- (void)refreshUI;
18+
19+
@end
20+
21+
22+
@interface CSTopiclistCell : SWTableViewCell
23+
24+
@end

0 commit comments

Comments
 (0)