Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 13636c1

Browse filesBrowse files
committed
修复我的话题Bug
1 parent 11c2913 commit 13636c1
Copy full SHA for 13636c1

File tree

Expand file treeCollapse file tree

3 files changed

+21
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+21
-7
lines changed
Open diff view settings
Collapse file

‎Coding_iOS/Controllers/Topic/CSMyTopicVC.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Controllers/Topic/CSMyTopicVC.m
+15-3Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,16 @@ - (void)viewDidLoad {
2929

3030
self.view.backgroundColor = [UIColor whiteColor];
3131

32-
self.segmentItems = @[@"我关注的", @"我参与的"];
33-
self.title = @"我的话题";
32+
if([self isMe]) {
33+
34+
self.segmentItems = @[@"我关注的", @"我参与的"];
35+
self.title = @"我的话题";
36+
}else {
37+
38+
self.segmentItems = @[@"Ta关注的", @"Ta参与的"];
39+
self.title = @"Ta的话题";
40+
}
41+
3442
_oldSelectedIndex = 0;
3543

3644
//添加myCarousel
@@ -64,6 +72,10 @@ - (void)viewDidLoad {
6472

6573
}
6674

75+
- (BOOL)isMe{
76+
return [_curUser.global_key isEqualToString:[Login curLoginUser].global_key];
77+
}
78+
6779
#pragma mark iCarousel M
6880
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel{
6981
return _segmentItems.count;
@@ -76,7 +88,7 @@ - (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
7688
}else{
7789
__weak CSMyTopicVC *weakSelf = self;
7890
CSMyTopicsType type = (index == 0 ? CSMyTopicsTypeWatched : CSMyTopicsTypeJoined);
79-
listView = [[CSTopiclistView alloc] initWithFrame:carousel.bounds type:type block:^(NSDictionary *topic) {
91+
listView = [[CSTopiclistView alloc] initWithFrame:carousel.bounds globalKey:_curUser.global_key type:type block:^(NSDictionary *topic) {
8092
[weakSelf goToTopic:topic];
8193
}];
8294
}
Collapse file

‎Coding_iOS/Controllers/Topic/CSTopiclistView.h‎

Copy file name to clipboardExpand all lines: Coding_iOS/Controllers/Topic/CSTopiclistView.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef enum {
1717

1818
@interface CSTopiclistView : UIView<UITableViewDataSource, UITableViewDelegate>
1919

20-
- (id)initWithFrame:(CGRect)frame type:(CSMyTopicsType )type block:(TopicListViewBlock)block;
20+
- (id)initWithFrame:(CGRect)frame globalKey:(NSString *)key type:(CSMyTopicsType )type block:(TopicListViewBlock)block;
2121
- (void)setTopics:(id )topics;
2222
- (void)refreshUI;
2323
- (void)refreshToQueryData;
Collapse file

‎Coding_iOS/Controllers/Topic/CSTopiclistView.m‎

Copy file name to clipboardExpand all lines: Coding_iOS/Controllers/Topic/CSTopiclistView.m
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ @interface CSTopiclistView()<SWTableViewCellDelegate>
2828

2929
//根据不同的type,走不同而数据更新逻辑,外界不传值进来
3030
@property (nonatomic,assign)CSMyTopicsType type;
31+
@property (nonatomic, strong) NSString *globalKey;
3132

3233
@property (nonatomic,assign)BOOL isLodding;
3334
@property (nonatomic, assign) BOOL hasMore;
@@ -37,11 +38,12 @@ @interface CSTopiclistView()<SWTableViewCellDelegate>
3738

3839
@implementation CSTopiclistView
3940

40-
- (id)initWithFrame:(CGRect)frame type:(CSMyTopicsType )type block:(TopicListViewBlock)block {
41+
- (id)initWithFrame:(CGRect)frame globalKey:(NSString *)key type:(CSMyTopicsType )type block:(TopicListViewBlock)block {
4142
self = [super initWithFrame:frame];
4243
if (self) {
4344
// Initialization code
4445
_dataList = [[NSMutableArray alloc] init];
46+
_globalKey = [key copy];
4547
_type = type;
4648
_block = block;
4749
_myTableView = ({
@@ -138,12 +140,12 @@ - (void)sendRequest{
138140
__weak typeof(self) weakSelf = self;
139141

140142
if (_type == CSMyTopicsTypeWatched) {
141-
[[Coding_NetAPIManager sharedManager] request_WatchedTopicsWithUserGK:[Login curLoginUser].global_key page:self.curPage block:^(id data, BOOL hasMoreData, NSError *error) {
143+
[[Coding_NetAPIManager sharedManager] request_WatchedTopicsWithUserGK:weakSelf.globalKey page:weakSelf.curPage block:^(id data, BOOL hasMoreData, NSError *error) {
142144
weakSelf.hasMore = hasMoreData;
143145
[weakSelf doAfterGotResultWithData:data error:error];
144146
}];
145147
}else{
146-
[[Coding_NetAPIManager sharedManager] request_JoinedTopicsWithUserGK:[Login curLoginUser].global_key page:self.curPage block:^(id data, BOOL hasMoreData, NSError *error) {
148+
[[Coding_NetAPIManager sharedManager] request_JoinedTopicsWithUserGK:weakSelf.globalKey page:weakSelf.curPage block:^(id data, BOOL hasMoreData, NSError *error) {
147149
weakSelf.hasMore = hasMoreData;
148150
[weakSelf doAfterGotResultWithData:data error:error];
149151
}];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.