cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/QMUIMainFrame/QMUICommonViewController.h

192 lines
8.8 KiB
C
Raw Normal View History

2023-07-27 09:20:00 +08:00
/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2021 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
//
// QMUICommonViewController.h
// qmui
//
// Created by QMUI Team on 14-6-22.
//
#import <UIKit/UIKit.h>
#import "QMUINavigationController.h"
#import "QMUIKeyboardManager.h"
NS_ASSUME_NONNULL_BEGIN
@class QMUINavigationTitleView;
@class QMUIEmptyView;
/**
* `UIViewController`
*
* 1. `QMUINavigationTitleView`loading使 `-[UIViewController setTitle:]` `-[UINavigationItem setTitle:]`
*
* 2. `QMUIEmptyView`loading
*
* 3. subview `navigationItem` `toolbarItem`...
*
* 4. `QMUINavigationController` 使 `willPopInNavigationControllerWithAnimated:``didPopInNavigationControllerWithAnimated:`
*
* @see QMUINavigationTitleView
* @see QMUIEmptyView
*/
@interface QMUICommonViewController : UIViewController {
QMUIEmptyView *_emptyView;
}
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
/**
* NS_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER NS_DESIGNATED_INITIALIZER
*/
- (void)didInitialize NS_REQUIRES_SUPER;
/**
* QMUICommonViewController默认都会增加一个QMUINavigationTitleView的titleViewsetTitle来间接设置titleView的值title的时候就跟系统的接口一样self.title = xxx
*
* QMUINavigationTitleView提供了更多的功能QMUINavigationTitleView的文档<br/>
* @see QMUINavigationTitleView
*/
@property(nullable, nonatomic, strong, readonly) QMUINavigationTitleView *titleView;
/**
* SupportedOrientationMask
*/
@property(nonatomic, assign) UIInterfaceOrientationMask supportedOrientationMask;
/**
* loading
*/
@property(nullable, nonatomic, strong) QMUIEmptyView *emptyView;
/// 当前self.emptyView是否显示
@property(nonatomic, assign, readonly, getter = isEmptyViewShowing) BOOL emptyViewShowing;
/**
* emptyView
* emptyView
*
* @see QMUIEmptyView
*/
- (void)showEmptyView;
/**
* loading的emptyView
*/
- (void)showEmptyViewWithLoading;
/**
* textdetailTextbutton的emptyView
*/
- (void)showEmptyViewWithText:(nullable NSString *)text
detailText:(nullable NSString *)detailText
buttonTitle:(nullable NSString *)buttonTitle
buttonAction:(nullable SEL)action;
/**
* imagetextdetailTextbutton的emptyView
*/
- (void)showEmptyViewWithImage:(nullable UIImage *)image
text:(nullable NSString *)text
detailText:(nullable NSString *)detailText
buttonTitle:(nullable NSString *)buttonTitle
buttonAction:(nullable SEL)action;
/**
* loadingimagetextdetailTextbutton的emptyView
*/
- (void)showEmptyViewWithLoading:(BOOL)showLoading
image:(nullable UIImage *)image
text:(nullable NSString *)text
detailText:(nullable NSString *)detailText
buttonTitle:(nullable NSString *)buttonTitle
buttonAction:(nullable SEL)action;
/**
* emptyView
*/
- (void)hideEmptyView;
/**
* emptyViewemptyView没有被初始化或者没被添加到界面上
*
*
*
* @return YES表示成功进行一次布局NO表示本次调用并没有进行布局操作emptyView还没被初始化
*/
- (BOOL)layoutEmptyView;
@end
@interface QMUICommonViewController (QMUISubclassingHooks)
/**
* controller里面的viewself.view的subViewview初始化的相关代码都写在这里
*
* @warning initSubviews只负责subviews的init <b>viewDidLayoutSubviews</b>
*/
- (void)initSubviews NS_REQUIRES_SUPER;
/**
* navigationItemtitleleftBarButtonItemrightBarButtonItemviewWillAppear navigationItem相关的代码都写在这里navigationItem的时候都统一调用这个接口
*/
- (void)setupNavigationItems NS_REQUIRES_SUPER;
/**
* toolbarItemviewWillAppear里面自动调用toolbar是navigationController的viewWillAppear时更新viewDidLoad里toolbarItem相关的代码都写在这里toolbarItem的时候都只调用这个接口
*/
- (void)setupToolbarItems NS_REQUIRES_SUPER;
/**
*
*
* font的设置或者reloadData可以放在里面
*
* @param notification test
*/
- (void)contentSizeCategoryDidChanged:(NSNotification *)notification;
@end
@interface QMUICommonViewController (QMUINavigationController) <QMUINavigationControllerDelegate>
/**
QMUINavigationControllerAppearanceDelegate
*/
- (void)updateNavigationBarAppearance;
@end
/**
* 便QMUICommonViewController tap self.view -shouldHideKeyboardWhenTouchInView: view BOOL
* @note hideKeyboardTapGestureRecognizer
* 1. enabled = NO
* 2. viewController QMUICommonViewController -shouldHideKeyboardWhenTouchInView: enabled = NO
* 3. viewController -shouldHideKeyboardWhenTouchInView: enabled YES NO
*/
@interface QMUICommonViewController (QMUIKeyboard)
/// 在 viewDidLoad 内初始化,并且 gestureRecognizerShouldBegin: 必定返回 NO。
@property(nullable, nonatomic, strong, readonly) UITapGestureRecognizer *hideKeyboardTapGestureRecognizer;
@property(nullable, nonatomic, strong, readonly) QMUIKeyboardManager *hideKeyboardManager;
/**
* UITextFieldUITextView view YES NO
* @note view iOS 11 view UIButton UISwitch
* @note view subview subview isDescendantOfView: subview
*/
- (BOOL)shouldHideKeyboardWhenTouchInView:(nullable UIView *)view;
@end
NS_ASSUME_NONNULL_END