@@ -90,36 +90,10 @@ - (void)viewDidLoad
90
90
icarousel.bounceDistance = 0.2 ;
91
91
[self .view addSubview: icarousel];
92
92
[icarousel mas_makeConstraints: ^(MASConstraintMaker *make) {
93
- // make.left.right.bottom.equalTo(self.view);
94
- // make.top.equalTo(self.view).offset(kMySegmentControl_Height);
95
93
make.edges .equalTo (self.view );
96
94
}];
97
95
icarousel;
98
96
});
99
-
100
- // //添加搜索框
101
- // _mySearchBar = ({
102
- // UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0,0, kScreen_Width-110, 31)];
103
- // searchBar.layer.cornerRadius=15;
104
- // searchBar.layer.masksToBounds=TRUE;
105
- // [searchBar.layer setBorderWidth:8];
106
- // [searchBar.layer setBorderColor:[UIColor whiteColor].CGColor]; //设置边框为白色
107
- // [searchBar sizeToFit];
108
- // searchBar.delegate = self;
109
- // [searchBar setPlaceholder:@"项目/任务/讨论/冒泡等"];
110
- // UITextField *searchField= [[[[searchBar subviews] firstObject] subviews] lastObject];
111
- // // [searchField setHeight:22];
112
- // // searchField.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
113
- // // [searchField setBackgroundColor:[UIColor blueColor]];
114
- // [(UIImageView*)[searchField leftView] setFrame:CGRectMake(0, 0, 13, 13)];
115
- // [(UIImageView*)[searchField leftView] setImage:[UIImage imageNamed:@"icon_search_searchbar"]];
116
- // [searchBar setImage:[UIImage imageNamed:@"icon_search_searchbar"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
117
- // [searchBar setTintColor:[UIColor whiteColor]];
118
- // [searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]];
119
- // [searchBar setHeight:31];
120
- // searchBar;
121
- // });
122
-
123
97
// 添加搜索框
124
98
_mySearchBar = ({
125
99
MainSearchBar *searchBar = [[MainSearchBar alloc ] initWithFrame: CGRectMake (60 ,7 , kScreen_Width -115 , 31 )];
@@ -132,26 +106,13 @@ - (void)viewDidLoad
132
106
[searchBar sizeToFit ];
133
107
[searchBar setTintColor: [UIColor whiteColor ]];
134
108
[searchBar insertBGColor: [UIColor colorWithHexString: @" 0xffffff" ]];
135
- // [searchBar setImage:nil forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
136
- // [searchBar setPositionAdjustment:UIOffsetMake(10,0) forSearchBarIcon:UISearchBarIconClear];
137
- // searchBar.searchTextPositionAdjustment=UIOffsetMake(10,0);
138
109
[searchBar setHeight: 30 ];
139
110
searchBar;
140
111
});
141
-
142
-
143
- // _searchView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width-110, 31)];//allocate titleView
144
- // UIColor *color = [UIColor colorWithHexString:[NSObject baseURLStrIsTest]? @"0x3bbd79" : @"0x28303b"];
145
- // [_searchView setBackgroundColor:color];
146
-
147
-
148
-
149
112
__weak typeof (_myCarousel) weakCarousel = _myCarousel;
150
113
151
114
// 初始化过滤目录
152
115
_myFliterMenu = [[PopFliterMenu alloc ] initWithFrame: CGRectMake (0 , 64 , kScreen_Width , kScreen_Height -64 ) items: nil ];
153
- // _myFliterMenu = [[PopFliterMenu alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height) items:nil];
154
-
155
116
__weak typeof (self) weakSelf = self;
156
117
_myFliterMenu.clickBlock = ^(NSInteger pageIndex){
157
118
if (pageIndex==1000 ) {
@@ -219,15 +180,43 @@ - (void)viewDidLoad
219
180
self.icarouselScrollEnabled = NO ;
220
181
}
221
182
183
+ - (void )viewWillAppear : (BOOL )animated {
184
+ [super viewWillAppear: animated];
185
+ [self .navigationController.navigationBar addSubview: _mySearchBar];
186
+ if (_myCarousel) {
187
+ ProjectListView *listView = (ProjectListView *)_myCarousel.currentItemView ;
188
+ if (listView) {
189
+ [listView refreshToQueryData ];
190
+ }
191
+ }
192
+ [_myFliterMenu refreshMenuDate ];
193
+ }
194
+
195
+ -(void )viewWillDisappear : (BOOL )animated
196
+ {
197
+ [super viewWillDisappear: animated];
198
+ [_mySearchBar removeFromSuperview ];
199
+ }
200
+
201
+ - (void )viewDidAppear : (BOOL )animated {
202
+ [super viewDidAppear: animated];
203
+ [[UnReadManager shareManager ] updateUnRead ];
204
+ }
205
+
206
+ #pragma mark - sub class method
222
207
- (void )setIcarouselScrollEnabled : (BOOL )icarouselScrollEnabled {
223
208
_myCarousel.scrollEnabled = icarouselScrollEnabled;
224
209
}
225
210
211
+ - (void )configSegmentItems {
212
+ _segmentItems = @[@" 全部项目" ,@" 我创建的" , @" 我参与的" ,@" 我关注的" ,@" 我收藏的" ];
213
+ }
214
+
215
+ #pragma mark - nav item
226
216
- (void )setupNavBtn {
227
217
228
218
_leftNavBtn=[UIButton new ];
229
219
[self addImageBarButtonWithImageName: @" filtertBtn_normal_Nav" button: _leftNavBtn action: @selector (fliterClicked: ) isRight: NO ];
230
-
231
220
// 变化按钮
232
221
_rightNavBtn = [[FRDLivelyButton alloc ] initWithFrame: CGRectMake (0 ,0 ,18.5 ,18.5 )];
233
222
[_rightNavBtn setOptions: @{ kFRDLivelyButtonLineWidth : @(1 .0f ),
@@ -237,60 +226,84 @@ - (void)setupNavBtn{
237
226
[_rightNavBtn addTarget: self action: @selector (addItemClicked: ) forControlEvents: UIControlEventTouchUpInside];
238
227
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc ] initWithCustomView: _rightNavBtn];
239
228
self.navigationItem .rightBarButtonItem = buttonItem;
240
-
241
- // __weak typeof(_myCarousel) weakCarousel = _myCarousel;
242
-
243
- // 添加滑块
244
- // _mySegmentControl = [[XTSegmentControl alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kMySegmentControl_Height) Items:_segmentItems selectedBlock:^(NSInteger index) {
245
- // if (index == _oldSelectedIndex) {
246
- // return;
247
- // }
248
- // [weakCarousel scrollToItemAtIndex:index animated:NO];
249
- // }];
250
- // [self.view addSubview:_mySegmentControl];
251
-
252
-
253
- // [self addImageBarButtonWithImageName:@"addBtn_Nav" button:_rightNavBtn action:@selector(addItemClicked:) isRight:YES];
254
-
255
229
}
256
230
257
- - (void )configSegmentItems {
258
- _segmentItems = @[@" 全部项目" ,@" 我创建的" , @" 我参与的" ,@" 我关注的" ,@" 我收藏的" ];
231
+ -(void )addItemClicked : (id )sender {
232
+ if (_rightNavBtn.buttonStyle == kFRDLivelyButtonStylePlus ) {
233
+ [_rightNavBtn setStyle: kFRDLivelyButtonStyleClose animated: YES ];
234
+ [_myPopMenu showMenuAtView: kKeyWindow startPoint: CGPointMake (0 , -100 ) endPoint: CGPointMake (0 , -100 )];
235
+ } else {
236
+ [_myPopMenu dismissMenu ];
237
+ }
259
238
}
260
239
261
- - (void )viewWillAppear : (BOOL )animated {
262
- [super viewWillAppear: animated];
263
- // [self.navigationItem.titleView sizeToFit];
264
- // [_searchView addSubview:_mySearchBar];
265
- // self.navigationItem.titleView = _searchView;
240
+ -(void )fliterClicked : (id )sender {
241
+ [self closeMenu ];
242
+ if (_myFliterMenu.showStatus ) {
243
+ [self fliterBtnClose: TRUE ];
244
+ [_myFliterMenu dismissMenu ];
245
+ }else
246
+ {
247
+ [self fliterBtnClose: FALSE ];
248
+ _myFliterMenu.selectNum =_selectNum>=3 ?_selectNum+1 :_selectNum;
249
+ UIView *presentView=[[[UIApplication sharedApplication ].keyWindow rootViewController ] view ];
250
+ [_myFliterMenu showMenuAtView: presentView];
251
+ }
252
+ }
266
253
267
- [self .navigationController.navigationBar addSubview: _mySearchBar];
254
+ -(void )closeFliter {
255
+ if ([_myFliterMenu showStatus ]) {
256
+ [_myFliterMenu dismissMenu ];
257
+ [self fliterBtnClose: TRUE ];
258
+ }
259
+ }
268
260
269
-
270
- if (_myCarousel) {
271
- ProjectListView *listView = (ProjectListView *)_myCarousel.currentItemView ;
272
- if (listView) {
273
- [listView refreshToQueryData ];
274
- }
261
+ -(void )closeMenu {
262
+ if ([_myPopMenu isShowed ]) {
263
+ [_rightNavBtn setStyle: kFRDLivelyButtonStylePlus animated: YES ];
264
+ [_myPopMenu dismissMenu ];
275
265
}
276
- [_myFliterMenu refreshMenuDate ];
277
266
}
278
267
279
- -(void )viewWillDisappear : (BOOL )animated
280
- {
281
- [super viewWillDisappear: animated];
282
- [_mySearchBar removeFromSuperview ];
268
+ -(void )fliterBtnClose : (BOOL )status {
269
+ [_leftNavBtn setImage: status?[UIImage imageNamed: @" filtertBtn_normal_Nav" ]:[UIImage imageNamed: @" filterBtn_selected_Nav" ] forState: UIControlStateNormal];
283
270
}
284
271
285
- - (void )viewDidAppear : (BOOL )animated {
286
- [super viewDidAppear: animated];
287
- [[UnReadManager shareManager ] updateUnRead ];
272
+ // 弹出事件
273
+ -(void )rotateView : (UIView*)aView
274
+ {
275
+ POPBasicAnimation* rotateAnimation = ({
276
+ POPBasicAnimation* basicAnimation=[POPBasicAnimation animationWithPropertyNamed: kPOPLayerRotation ];
277
+ basicAnimation.toValue = @(22.5 * (M_PI / 180 .0f ));
278
+ basicAnimation.timingFunction =[CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut ];
279
+ basicAnimation.duration = 0 .2f ;
280
+ [basicAnimation setCompletionBlock: ^(POPAnimation * ani, BOOL fin) {
281
+ if (fin) {
282
+ }
283
+ }];
284
+ basicAnimation;
285
+ });
286
+ [aView.layer pop_addAnimation: rotateAnimation forKey: @" rotateAnimation" ];
288
287
}
289
288
290
- - (void )didReceiveMemoryWarning
289
+ -(void )addImageBarButtonWithImageName : ( NSString *) imageName button : (UIButton*) aBtn action : ( SEL ) action isRight : ( BOOL ) isR
291
290
{
292
- [super didReceiveMemoryWarning ];
293
- // Dispose of any resources that can be recreated.
291
+ UIImage *image = [UIImage imageNamed: imageName];
292
+ CGRect frame = CGRectMake (0 ,0 , image.size .width , image.size .height );
293
+
294
+ aBtn.frame =frame;
295
+ [aBtn setImage: image forState: UIControlStateNormal];
296
+ [aBtn addTarget: self action: action forControlEvents: UIControlEventTouchUpInside];
297
+
298
+ UIBarButtonItem* barButtonItem = [[UIBarButtonItem alloc ] initWithCustomView: aBtn];
299
+
300
+ if (isR)
301
+ {
302
+ [self .navigationItem setRightBarButtonItem: barButtonItem];
303
+ }else
304
+ {
305
+ [self .navigationItem setLeftBarButtonItem: barButtonItem];
306
+ }
294
307
}
295
308
296
309
#pragma mark iCarousel M
@@ -369,23 +382,6 @@ - (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel
369
382
}
370
383
371
384
#pragma mark VC
372
- -(void )addItemClicked : (id )sender {
373
- [self closeFliter ];
374
- if (_rightNavBtn.buttonStyle == kFRDLivelyButtonStylePlus ) {
375
- [_rightNavBtn setStyle: kFRDLivelyButtonStyleClose animated: YES ];
376
- UIView *presentView=[[[UIApplication sharedApplication ].keyWindow rootViewController ] view ];
377
- // [presentView bringSubviewToFront:[presentView.subviews firstObject]];
378
- // [_myPopMenu showMenuAtView:self.view startPoint:CGPointMake(0, -100) endPoint:CGPointMake(0, -100) withTabFooterView:presentView];
379
- // [_myPopMenu showMenuAtView:self.view startPoint:CGPointMake(0, -100) endPoint:CGPointMake(0, -100)];
380
- [_myPopMenu showMenuAtView: presentView startPoint: CGPointMake (0 , -100 ) endPoint: CGPointMake (0 , -100 )];
381
-
382
-
383
- } else {
384
- [_rightNavBtn setStyle: kFRDLivelyButtonStylePlus animated: YES ];
385
- [_myPopMenu dismissMenu ];
386
- }
387
- }
388
-
389
385
- (void )goToNewProjectVC {
390
386
UIStoryboard *newProjectStoryboard = [UIStoryboard storyboardWithName: @" NewProject" bundle: nil ];
391
387
UIViewController *newProjectVC = [newProjectStoryboard instantiateViewControllerWithIdentifier: @" NewProjectVC" ];
@@ -440,97 +436,6 @@ - (void)goToProjectSquareVC{
440
436
[self .navigationController pushViewController: vc animated: YES ];
441
437
}
442
438
443
-
444
- -(void )closeFliter {
445
- if ([_myFliterMenu showStatus ]) {
446
- [_myFliterMenu dismissMenu ];
447
- [self fliterBtnClose: TRUE ];
448
- }
449
- }
450
-
451
- -(void )closeMenu {
452
- if ([_myPopMenu isShowed ]) {
453
- [_rightNavBtn setStyle: kFRDLivelyButtonStylePlus animated: YES ];
454
- [_myPopMenu dismissMenu ];
455
- }
456
- }
457
-
458
- -(void )fliterBtnClose : (BOOL )status {
459
- [_leftNavBtn setImage: status?[UIImage imageNamed: @" filtertBtn_normal_Nav" ]:[UIImage imageNamed: @" filterBtn_selected_Nav" ] forState: UIControlStateNormal];
460
- }
461
-
462
- // 弹出事件
463
- -(void )rotateView : (UIView*)aView
464
- {
465
- POPBasicAnimation* rotateAnimation = ({
466
- POPBasicAnimation* basicAnimation=[POPBasicAnimation animationWithPropertyNamed: kPOPLayerRotation ];
467
- basicAnimation.toValue = @(22.5 * (M_PI / 180 .0f ));
468
- basicAnimation.timingFunction =[CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut ];
469
- basicAnimation.duration = 0 .2f ;
470
- [basicAnimation setCompletionBlock: ^(POPAnimation * ani, BOOL fin) {
471
- if (fin) {
472
- }
473
- }];
474
- basicAnimation;
475
- });
476
- [aView.layer pop_addAnimation: rotateAnimation forKey: @" rotateAnimation" ];
477
-
478
-
479
-
480
- // [UIView beginAnimations:nil context:nil];
481
- // [UIView setAnimationDuration:0.2];
482
- // [UIView setAnimationDelegate:self];
483
- // aView.transform = CGAffineTransformMakeRotation(22.5 * (M_PI / 180.0f));
484
- // [UIView commitAnimations];
485
-
486
- }
487
-
488
- -(void )addImageBarButtonWithImageName : (NSString *)imageName button : (UIButton*)aBtn action : (SEL )action isRight : (BOOL )isR
489
- {
490
- UIImage *image = [UIImage imageNamed: imageName];
491
- CGRect frame = CGRectMake (0 ,0 , image.size .width , image.size .height );
492
-
493
- aBtn.frame =frame;
494
- [aBtn setImage: image forState: UIControlStateNormal];
495
- [aBtn addTarget: self action: action forControlEvents: UIControlEventTouchUpInside];
496
-
497
- UIBarButtonItem* barButtonItem = [[UIBarButtonItem alloc ] initWithCustomView: aBtn];
498
-
499
- if (isR)
500
- {
501
- [self .navigationItem setRightBarButtonItem: barButtonItem];
502
- }else
503
- {
504
- [self .navigationItem setLeftBarButtonItem: barButtonItem];
505
- }
506
- }
507
-
508
-
509
-
510
-
511
- #pragma mark fliter
512
- -(void )fliterClicked : (id )sender {
513
- [self closeMenu ];
514
- if (_myFliterMenu.showStatus ) {
515
- [self fliterBtnClose: TRUE ];
516
- // UIView *presentView=[[[UIApplication sharedApplication].keyWindow rootViewController] view];
517
- // if ([[presentView.subviews firstObject] isMemberOfClass:NSClassFromString(@"RDVTabBar")]) {
518
- // [presentView bringSubviewToFront:[presentView.subviews firstObject]];
519
- // }
520
- [_myFliterMenu dismissMenu ];
521
- }else
522
- {
523
- [self fliterBtnClose: FALSE ];
524
- _myFliterMenu.selectNum =_selectNum>=3 ?_selectNum+1 :_selectNum;
525
- // UIView *presentView=[[[UIApplication sharedApplication].keyWindow rootViewController] view];
526
- // [presentView bringSubviewToFront:[presentView.subviews firstObject]];
527
- UIView *presentView=[[[UIApplication sharedApplication ].keyWindow rootViewController ] view ];
528
- [_myFliterMenu showMenuAtView: presentView];
529
- // [_myFliterMenu showMenuAtView:self.view];
530
- }
531
- }
532
-
533
-
534
439
#pragma mark Search
535
440
- (void )searchItemClicked : (id )sender {
536
441
[_mySearchBar setX: 20 ];
@@ -552,8 +457,7 @@ - (void)searchItemClicked:(id)sender{
552
457
[_mySearchBar becomeFirstResponder ];
553
458
}
554
459
555
- -(void )searchAction
556
- {
460
+ -(void )searchAction {
557
461
if (!_mySearchDisplayController) {
558
462
_mySearchDisplayController = ({
559
463
UISearchDisplayController *searchVC = [[UISearchDisplayController alloc ] initWithSearchBar: _mySearchBar contentsController: self ];
@@ -570,20 +474,14 @@ -(void)searchAction
570
474
}
571
475
}
572
476
573
-
574
- -(void )goToSearchVC
575
- {
477
+ -(void )goToSearchVC {
576
478
[self closeFliter ];
577
479
[self closeMenu ];
578
480
SearchViewController *vc=[SearchViewController new ];
579
- // [self.navigationController pushViewController:vc animated:NO];
580
-
581
481
BaseNavigationController *searchNav=[[BaseNavigationController alloc ]initWithRootViewController:vc];
582
482
[self .navigationController presentViewController: searchNav animated: NO completion: nil ];
583
483
}
584
484
585
-
586
-
587
485
#pragma mark Table
588
486
- (NSInteger )numberOfSectionsInTableView : (UITableView *)tableView {
589
487
return 1 ;
@@ -616,10 +514,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
616
514
617
515
#pragma mark UISearchBarDelegate
618
516
619
- - (BOOL )searchBarShouldBeginEditing : (UISearchBar *)searchBar
620
- {
621
- // [self searchAction];
622
- // [searchBar setShowsCancelButton:YES animated:YES];
517
+ - (BOOL )searchBarShouldBeginEditing : (UISearchBar *)searchBar {
623
518
[self goToSearchVC ];
624
519
return NO ;
625
520
0 commit comments