Skip to content

Commit 1841e22

Browse files
committed
update README for new API shouldSelectPlusChildViewController
1 parent ae647e0 commit 1841e22

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

CYLTabBarController/CYLPlusButton.h

+7
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
*/
5555
+ (UIViewController *)plusChildViewController;
5656

57+
/*!
58+
*
59+
Asks the delegate whether the specified view controller should be made active.
60+
Return YES if the view controller’s tab should be selected or NO if the current tab should remain active.
61+
Returns YES true if the view controller’s tab should be selected or
62+
NO false if the current tab should remain active.
63+
*/
5764
+ (BOOL)shouldSelectPlusChildViewController;
5865

5966
#pragma mark - Deprecated API

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ pod update
308308
+ (NSUInteger)indexOfPlusButtonInTabBar;
309309
+ (CGFloat)multiplierOfTabBarHeight:(CGFloat)tabBarHeight;
310310
+ (UIViewController *)plusChildViewController;
311+
+ (BOOL)shouldSelectPlusChildViewController;
311312
```
312313

313314
作用分别是:
@@ -520,10 +521,33 @@ Airbnb-app效果:
520521

521522
注意:必须同时实现 `+indexOfPlusButtonInTabBar` 来指定 PlusButton 的位置。
522523

523-
遵循两个协议
524+
遵循几个协议
524525

525526
![enter image description here](http://i64.tinypic.com/14jw5zt.jpg)
526527

528+
529+
另外你可以通过下面这个方法获取到 `PlusButton` 的点击事件:
530+
531+
```Objective-C
532+
+ (BOOL)shouldSelectPlusChildViewController;
533+
```
534+
535+
用法如下:
536+
537+
538+
```Objective-C
539+
+ (BOOL)shouldSelectPlusChildViewController {
540+
BOOL isSelected = CYLExternPlusButton.selected;
541+
if (isSelected) {
542+
NSLog(@"🔴类名与方法名:%@(在第%@行),描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), @"PlusButton is selected");
543+
} else {
544+
NSLog(@"🔴类名与方法名:%@(在第%@行),描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), @"PlusButton is not selected");
545+
}
546+
return YES;
547+
}
548+
549+
```
550+
527551
## 让TabBarItem仅显示图标,并使图标垂直居中
528552

529553
要想实现该效果,只需要在设置 `tabBarItemsAttributes`该属性时不传 title 即可。

0 commit comments

Comments
 (0)