| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | 11 | #import <QuartzCore/QuartzCore.h> | |
| 12 | 12 | #import "TopicHotkeyView.h" | |
| 13 | + #import "Coding_NetAPIManager.h" | ||
| 13 | 14 | ||
| 14 | 15 | @interface CSSearchDisplayVC () | |
| 15 | 16 | ||
@@ -100,9 +101,20 @@ - (void)initSubViewsInContentView { | |||
| 100 | 101 | // itemView.frame = CGRectMake(12.0f, 50.0f, 100.0, 100.0f); | |
| 101 | 102 | // [_contentView addSubview:itemView]; | |
| 102 | 103 | ||
| 103 | - TopicHotkeyView *test = [[TopicHotkeyView alloc] initWithHotkeys:@[@"我最爱的编程语言", @"coding", @"PHP", @"gopher china", @"悬赏80,000", @"Coding客户端里私信做个轮询好不好"] | ||
| 104 | - withFrame:CGRectMake(0.0f, 40.0f, 160.0f, 25.0f)]; | ||
| 105 | - [_contentView addSubview:test]; | ||
| 104 | + __weak typeof(_contentView) __contentView = _contentView; | ||
| 105 | + | ||
| 106 | + [[Coding_NetAPIManager sharedManager] request_TopicHotkeyWithBlock:^(id data, NSError *error) { | ||
| 107 | + if(data) { | ||
| 108 | + NSArray *array = data; | ||
| 109 | + NSMutableArray *hotkeyArray = [[NSMutableArray alloc] initWithCapacity:6]; | ||
| 110 | + for (int i = 0; i < (array.count >= 6 ? 6 : array.count); i++) { | ||
| 111 | + [hotkeyArray addObject:[(NSDictionary *)array[i] objectForKey:@"name"]]; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + TopicHotkeyView *test = [[TopicHotkeyView alloc] initWithHotkeys:hotkeyArray withFrame:CGRectMake(0.0f, 40.0f, 160.0f, 25.0f)]; | ||
| 115 | + [__contentView addSubview:test]; | ||
| 116 | + } | ||
| 117 | + }]; | ||
| 106 | 118 | } | |
| 107 | 119 | ||
| 108 | 120 | - (void)didClickedMoreHotkey:(id)sender { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -210,4 +210,7 @@ typedef NS_ENUM(NSUInteger, VerifyType){ | |||
| 210 | 210 | - (void)request_Users_WithSearchString:(NSString *)searchStr andBlock:(void (^)(id data, NSError *error))block; | |
| 211 | 211 | - (void)request_MDHtmlStr_WithMDStr:(NSString *)mdStr inProject:(Project *)project andBlock:(void (^)(id data, NSError *error))block; | |
| 212 | 212 | - (void)request_VerifyTypeWithBlock:(void (^)(VerifyType type, NSError *error))block; | |
| 213 | + | ||
| 214 | + //Topic HotKey | ||
| 215 | + - (void)request_TopicHotkeyWithBlock:(void (^)(id data, NSError *error))block; | ||
| 213 | 216 | @end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1946,4 +1946,24 @@ - (void)request_VerifyTypeWithBlock:(void (^)(VerifyType type, NSError *error))b | |||
| 1946 | 1946 | } | |
| 1947 | 1947 | }]; | |
| 1948 | 1948 | } | |
| 1949 | + | ||
| 1950 | + #pragma mark - | ||
| 1951 | + #pragma mark Topic HotKey | ||
| 1952 | + | ||
| 1953 | + - (void)request_TopicHotkeyWithBlock:(void (^)(id data, NSError *error))block { | ||
| 1954 | + | ||
| 1955 | + NSString *path = @"/api/tweet_topic/hot?page=1&pageSize=20"; | ||
| 1956 | + [[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:path withParams:nil withMethodType:Get andBlock:^(id data, NSError *error) { | ||
| 1957 | + | ||
| 1958 | + if(data) { | ||
| 1959 | + | ||
| 1960 | + id resultData = [data valueForKey:@"data"]; | ||
| 1961 | + block(resultData, nil); | ||
| 1962 | + }else { | ||
| 1963 | + | ||
| 1964 | + block(nil, error); | ||
| 1965 | + } | ||
| 1966 | + }]; | ||
| 1967 | + } | ||
| 1968 | + | ||
| 1949 | 1969 | @end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,6 +78,11 @@ - (id)initWithHotkeys:(NSArray *)hotkeys withFrame:(CGRect)frame { | |||
| 78 | 78 | } | |
| 79 | 79 | } | |
| 80 | 80 | ||
| 81 | + if(i == hotkeys.count - 1) { | ||
| 82 | + | ||
| 83 | + currentHeight += currentSize.height + 15.0f; | ||
| 84 | + } | ||
| 85 | + | ||
| 81 | 86 | [self addSubview:lblHotKey]; | |
| 82 | 87 | currentSize = CGSizeZero; | |
| 83 | 88 | lblHotKey = nil; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments