iOS之单独使用UISearchBar创建搜索框
https://www.jianshu.com/p/dd6f0a0b1781
1.实现代理UISearchBarDelegate
@interface SearchViewController ()<UISearchBarDelegate>
2.创建一个UISearchBar为属性
@property (nonatomic, strong) UISearchBar *searchBar;
3.进入页面后弹起键盘和离开页面前收起键盘
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (!_searchBar.isFirstResponder) {
[self.searchBar becomeFirstResponder];
}
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.searchBar resignFirstResponder];
}
4.具体实现
-(UISearchBar *)searchBar{
**if** (!_searchBar) {
//创建searchBar
_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 10,20)];
//默认提示文字
_searchBar.placeholder = @"搜索内容";
//背景图片
_searchBar.backgroundImage = [UIImage imageNamed:@"clearImage"];
//代理
_searchBar.delegate = **self**;
//显示右侧取消按钮
_searchBar.showsCancelButton = **YES**;
//光标颜色
_searchBar.tintColor = [UIColor blackColor];
// [_searchBar setBackgroundColor:[UIColor whiteColor]];
[_searchBar.searchTextField setBackgroundColor:[UIColor whiteColor]];
[**self**.navigationController.navigationBar addSubview:_searchBar];
[_searchBar mas_makeConstraints:^(MASConstraintMaker *make){
make.leading.mas_equalTo(**self**.navigationController.navigationBar).offset(60);
make.trailing.mas_equalTo(**self**.navigationController.navigationBar).offset(-20);
make.centerY.mas_equalTo(0);
make.height.mas_equalTo(44);
}];
}
return _searchBar;
}
-(UIButton *)searchBtn{
if (!_searchBtn) {
_searchBtn = [self.searchBar valueForKeyPath:@"cancelButton"];
_searchBtn.enabled = YES;
[_searchBtn setTitle:@"取消" forState:UIControlStateNormal];
[_searchBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_searchBtn addTarget:self action:@selector(searchButtonClicked) forControlEvents:UIControlEventTouchUpInside];
}
return _searchBtn;
}
字体列表
、苹方-简 常规体
font-family: PingFangSC-Regular, sans-serif;
苹方-简 极细体
font-family: PingFangSC-Ultralight, sans-serif;
苹方-简 细体
font-family: PingFangSC-Light, sans-serif;
苹方-简 纤细体
font-family: PingFangSC-Thin, sans-serif;
苹方-简 中黑体
font-family: PingFangSC-Medium, sans-serif;
苹方-简 中粗体
font-family: PingFangSC-Semibold, sans-serif;
- (void)setBarButtonItem
{
//隐藏导航栏上的返回按钮
[self.navigationItem setHidesBackButton:YES];
//用来放searchBar的View
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(5, 7, self.view.frame.size.width, 30)];
//创建searchBar
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(titleView.frame) - 15, 30)];
//默认提示文字
searchBar.placeholder = @"搜索内容";
//背景图片
searchBar.backgroundImage = [UIImage imageNamed:@"clearImage"];
//代理
searchBar.delegate = self;
//显示右侧取消按钮
searchBar.showsCancelButton = YES;
//光标颜色
searchBar.tintColor = UIColorFromRGB(0x595959);
//拿到searchBar的输入框
UITextField *searchTextField = [searchBar valueForKey:@"_searchField"];
//字体大小
searchTextField.font = [UIFont systemFontOfSize:15];
//输入框背景颜色
searchTextField.backgroundColor = [UIColor colorWithRed:234/255.0 green:235/255.0 blue:237/255.0 alpha:1];
//拿到取消按钮
UIButton *cancleBtn = [searchBar valueForKey:@"cancelButton"];
//设置按钮上的文字
[cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
//设置按钮上文字的颜色
[cancleBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[titleView addSubview:searchBar];
self.searchBar = searchBar;
self.navigationItem.titleView = titleView;
}
5.实现代理方法
#pragma mark - UISearchBarDelegate
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{
return YES;
}
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
searchBar.showsCancelButton = YES;
}
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
NSLog(@"SearchButton");
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
[self.searchBar resignFirstResponder];
[self.navigationController popViewControllerAnimated:YES];
}
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
searchBar.showsCancelButton = YES;
}
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
NSString *inputStr = searchText;
[self.results removeAllObjects];
for (ElderModel *model in self.dataArray) {
if ([model.name.lowercaseString rangeOfString:inputStr.lowercaseString].location != NSNotFound) {
[self.results addObject:model];
}
}
[self.tableView reloadData];
}
代码
按钮
btn.titleLabel.font = [UIFont systemFontOfSize: 14.0];
btn.titleLabel.font = [UIFont fontWithName:@”PingFangSC-Regular” size: 14];
btn.contentHorizontalAlignment = UIControlContentHorizonAlignmentLeft
btn.contentEdgeInsets = UIEdgeInsetsMake(0,10, 0, 0);
[btn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
Xib
按钮
设置圆角:Key Path:layer.cornerRadius Type:Number Value:8
设置边框宽度:Key Path:layer.borderWidth Type:Number Value:1
如果要设置边框的颜色:Key Path:layer.borderColor Type:Color Value值默认,此时边框颜色为黑色,若要改变Value的值,则边框消失
注意:在设置属性的时候,千万不要写错,我开始的时候是复制过来的,多了一个空格,结果就无法显示设置的效果
下面介绍如何设置边框颜色:
要想设置任意的边框颜色,首先要对CALayer添加category,然后在category中添加一个方法
具体步骤如下:
1.创建category
command+N创建新文件,选择iOS→Source→Objective-C File,然后File Type选择Category,Class选择CALayer,File为自定义文件名
2.在.m文件中添加方法
创建好文件后,在.m文件新增方法
- (void)setBorderColorWithUIColor:(UIColor *)color
{
self.borderColor = color.CGColor;
}
此时会报错,需要导入头文件
#import <UIKit/UIKit.h>
3.在xib中添加属性
在xib中设置边框颜色,添加属性Key Path:layer.borderColorWithUIColor Type:Color 此时Value可以任意选择
再次提醒:填写Key Path的时候一定要填写正确,即使多一个空格也不会显示对应的效果
自定义xib cell的 uitableview
//
// SPRDeviceViewController.m
// SafeProduction
//
// Created by 胡礼节 on 2020/10/14.
//
\#import "SPRDeviceViewController.h"
\#import "TextContentTableViewCell.h"
**static** NSString *CellIdentifier = @"cellId";
**@interface** SPRDeviceViewController ()<UITableViewDelegate,UITableViewDataSource>{
UITableView *tableView;
NSMutableArray *dataArray;
``
}
**@end**
**@implementation** SPRDeviceViewController
\- (**void**)viewDidLoad {
[**super** viewDidLoad];
dataArray = [[NSMutableArray alloc]initWithArray: @[@"1",@"2"]];
tableView = [[UITableView alloc]initWithFrame:**self**.view.frame style:UITableViewStylePlain];
[tableView registerNib:[UINib nibWithNibName:@"TextContentTableViewCell" bundle:**nil**] forCellReuseIdentifier:CellIdentifier];
tableView.delegate = **self**;
tableView.dataSource = **self**;
[**self**.view addSubview:tableView];
// Do any additional setup after loading the view.
}
/*
\#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
\- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
\- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
**return** Ratio(170);
}
\- (**nonnull** UITableViewCell *)tableView:(**nonnull** UITableView *)tableView cellForRowAtIndexPath:(**nonnull** NSIndexPath *)indexPath {
``
TextContentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
``
``
``
**return** cell;
}
\- (NSInteger)tableView:(**nonnull** UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
**return** dataArray.count;
}
**@end
**
通知
/注册通知//方法实现
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updatCardInfo:) name:updateCardInfoNotification object:nil];
//方法实现
-(void) updatCardInfo :(NSNotification*) notification
{
接收参数 = [notification object]; //通过这个获取到传递的对象
}
//发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:updateCardInfoNotification object:参数];
2、不带参数
//注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceDamage) name:VDBlueToothDamageNotification object:nil];
//方法实现
-(void)deviceDamage
{
}
//发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:VDBlueToothDamageNotification object:nil];
网络
form表单
https://www.jianshu.com/p/ab4068abf847
NSDATE 时间
//方式三
NSDateFormatter *dateFmt2 = [[NSDateFormatter alloc]init];
dateFmt2.dateFormat = @"yyyy年MM年dd日 HH时mm分ss秒 aa";
NSString *dateStr2 = [dateFmt2 stringFromDate:date];
NSLog(@"方式三: %@",dateStr2);
键盘
https://www.jianshu.com/p/532d12375e9a
动画
self.treeImgView.transform = CGAffineTransformIdentity;
CGRect oldFrame = self.treeImgView.frame;
[self.treeImgView layer].anchorPoint = CGPointMake(0.5f, 1.0f);
self.treeImgView.frame = oldFrame;
CASpringAnimation *ani = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
ani.mass = 500.0;
ani.stiffness = 100000;
ani.damping = 3000.0;
ani.initialVelocity = 90.f;
ani.duration = ani.settlingDuration;
ani.toValue = [NSNumber numberWithFloat:1.01];
ani.removedOnCompletion = NO;
ani.fillMode = kCAFillModeForwards;
ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
[self.treeImgView.layer addAnimation:ani forKey:@”springAni”];
//
CASpringAnimation *ani1 = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
[ani1 setBeginTime:ani.settlingDuration / 3];
ani1.mass = 28.0;
ani1.stiffness = 5000;
ani1.damping = 120.0;
ani1.initialVelocity = 4.f;
ani1.duration = ani1.settlingDuration;
// ani.duration = ani.settlingDuration;
ani1.duration = ani1.settlingDuration;
// ani.fromValue = [NSValueTransformer CGAffineTransformMakeScale(1,1.1)];
ani1.toValue = [NSNumber numberWithFloat:1];
// ani.toValue = [NSValue valueWithCGRect:CGRectMake(50,150, 300, 250)];
ani1.removedOnCompletion = NO;
ani1.fillMode = kCAFillModeForwards;
ani1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
// [self.treeImgView.layer addAnimation:ani1 forKey:@”springAni”];
//
//
//
// CASpringAnimation *ani2 = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
// [ani2 setBeginTime:ani1.settlingDuration / 2 + ani.settlingDuration / 2 ];
// ani2.mass = 8.0;
// ani2.stiffness = 2000;
// ani2.damping = 120.0;
// ani2.initialVelocity = 4.f;
// ani2.duration = 1;
//// ani.fromValue = [NSValueTransformer CGAffineTransformMakeScale(1,1.1)];
// ani2.toValue = [NSNumber numberWithFloat:1.05];
//// ani.toValue = [NSValue valueWithCGRect:CGRectMake(50,150, 300, 250)];
// ani2.removedOnCompletion = NO;
// ani2.fillMode = kCAFillModeForwards;
// ani2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
//
//
//
//
// CASpringAnimation *ani3 = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
// [ani3 setBeginTime:ani1.settlingDuration / 2 + ani.settlingDuration / 2 + ani2.settlingDuration / 2];
// ani3.mass = 8.0;
// ani3.stiffness = 2000;
// ani3.damping = 120.0;
// ani3.initialVelocity = 4.f;
// ani3.duration = 1.0f;
//// ani.fromValue = [NSValueTransformer CGAffineTransformMakeScale(1,1.1)];
// ani3.toValue = [NSNumber numberWithFloat:1];
//// ani.toValue = [NSValue valueWithCGRect:CGRectMake(50,150, 300, 250)];
// ani3.removedOnCompletion = NO;
// ani3.fillMode = kCAFillModeForwards;
// ani3.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
//
//
//
CAAnimationGroup *group = [CAAnimationGroup animation];
// 添加动画
group.animations = [NSArray arrayWithObjects:ani, nil];
//取消动画反弹
group.removedOnCompletion = NO;
//设置动画执行完成后保持最新的效果
// group.fillMode = kCAFillModeForwards;
float t = 0.0 ;
float tr1 = 1.2;
float tr2 = 1;
NSMutableArray *array = [NSMutableArray new];
for (int i = 0; i < 10; i ++) {
if (i % 2 == 0) {
CASpringAnimation *ani5 = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
ani5.mass = 8.0;
ani5.stiffness = 2000;
ani5.damping = 120.0;
ani5.initialVelocity = 4.f;
ani5.duration = ani5.settlingDuration;
// ani.fromValue = [NSValueTransformer CGAffineTransformMakeScale(1,1.1)];
ani5.toValue = [NSNumber numberWithFloat:tr1];
// ani.toValue = [NSValue valueWithCGRect:CGRectMake(50,150, 300, 250)];
ani5.removedOnCompletion = NO;
ani5.fillMode = kCAFillModeForwards;
ani5.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
tr1 -= 0.02;
// t += ani5.settlingDuration / 2;
t += ani5.settlingDuration ;
[ani5 setBeginTime:t];
// group.animations
[array addObject:ani5];
}else{
CASpringAnimation *ani5 = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
ani5.mass = 8.0;
ani5.stiffness = 2000;
ani5.damping = 120.0;
ani5.initialVelocity = 4.f;
ani5.duration = ani5.settlingDuration;
// ani.fromValue = [NSValueTransformer CGAffineTransformMakeScale(1,1.1)];
ani5.toValue = [NSNumber numberWithFloat:1];
// ani.toValue = [NSValue valueWithCGRect:CGRectMake(50,150, 300, 250)];
ani5.removedOnCompletion = NO;
ani5.fillMode = kCAFillModeForwards;
ani5.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
tr1 -= 0.02;
// t += ani5.settlingDuration / 2;
t += ani5.settlingDuration ;
[ani5 setBeginTime:t];
[array addObject:ani5];
}
}
// 动画选项设定
group.duration = ani.settlingDuration ;
group.repeatCount = 1;
// group.animations = array;
// [self.treeImgView.layer addAnimation:group forKey:@”springAni”];
//
// // CGPoint center = self.treeImgView.center;
// CGRect oldFrame = self.treeImgView.frame;
//
// [self.treeImgView layer].anchorPoint = CGPointMake(0.5f, 1.0f);
//
// self.treeImgView.frame = oldFrame;
// // self.treeImgView.transform = CGAffineTransformMakeScale(1, 1.05);
// self.treeImgView.transform = CGAffineTransformMakeScale(1, 0.99);
// [UIView animateWithDuration:1
// delay:0
// usingSpringWithDamping:0.25
// initialSpringVelocity:0
// options:UIViewAnimationOptionCurveLinear
// animations:^{
//
// self.treeImgView.transform = CGAffineTransformMakeScale(1, 1);
//
//
// } completion:^(BOOL finished) {
//
// if(finished)
// {
// // [UIView animateWithDuration:0.15 animations:^{
// self.treeImgView.transform = CGAffineTransformIdentity;
// // }];
//
// }
//
// }];
self.treeImgView.transform = CGAffineTransformIdentity;
CGRect oldFrame = self.treeImgView.frame;
[self.treeImgView layer].anchorPoint = CGPointMake(0.5f, 1.0f);
self.treeImgView.frame = oldFrame;
CASpringAnimation *ani = [CASpringAnimation animationWithKeyPath:@”transform.scale.y”];
ani.mass = 500.0;
ani.stiffness = 100000;
ani.damping = 3000.0;
ani.initialVelocity = 90.f;
ani.duration = ani.settlingDuration;
ani.toValue = [NSNumber numberWithFloat:1.01];
ani.removedOnCompletion = NO;
ani.fillMode = kCAFillModeForwards;
ani.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
[self.treeImgView.layer addAnimation:ani forKey:@”springAni”];
collcetionView
https://www.jianshu.com/p/d0b034f59020
https://www.jianshu.com/p/f0eeef56f391
快捷键汇总
NSObject
pa
- 定义一个assign
的 propertypar
- 定义一个assign, readonly
的 propertypc
- 定义一个copy
的 propertypcr
- 定义一个copy, readonly
的 propertyps
- 定义一个strong
的propertypsr
- 定义一个strong, readonly
的propertypw
- 定义一个weak
的propertypwr
- 定义一个weak, readonly
的propertyload_once
- 创建一个带dispatch_once
的+load
方法propertySwizzleAssign
- 用swizzle
的方式定义一个assign
的propertypropertySwizzleCopy
- 用swizzle
的方式定义一个copy
的propertypropertySwizzleStrong
- 用swizzle
的方式定义一个strong
的propertypropertySwizzleWeak
- 用swizzle
的方式定义一个weak
的propertysharedInstance
- 为当前类创建一个实现单例功能的sharedInstance
方法exchangeImplementation
- 重写当前类的load
方法并在其中用swizzle
替换方法实现exchangeImplementation_QMUI
- 用 QMUI 重写当前类的load
方法并用ExchangeImplementations()
函数替换方法的实现exchangeMultipleImplementations_QMUI
- 用 QMUI 重写当前类的load
方法并用ExchangeImplementations()
函数批量替换多个方法的实现override_void_non_argv
- 用 QMUI 的OverrideImplementation()
重写指定 class 的某个无返回值、无参数的方法实现override_void_single_argv
- 用 QMUI 的OverrideImplementation()
修改指定 class 的某个无返回值、带一个参数的方法实现override_void_two_argvs
- 用 QMUI 的OverrideImplementation()
修改指定 class 的某个无返回值、带两个参数的方法实现override_return_non_argv
- 用 QMUI 的OverrideImplementation()
修改指定 class 的某个带返回值、无参数的方法实现override_return_single_argv
- 用 QMUI 的OverrideImplementation()
修改指定 class 的某个带返回值、带一个参数的方法实现override_return_two_argvs
- 用 QMUI 的OverrideImplementation()
修改指定 class 的某个带返回值、带两个参数的方法实现extend_void_non_argv
- 用 QMUI 的ExtendImplementationOfVoidMethodWithoutArguments()
修改指定 class 的某个无返回值、无参数的方法实现extend_void_single_argv
- 用 QMUI 的ExtendImplementationOfVoidMethodWithSingleArgument()
修改指定 class 的某个无返回值、带一个参数的方法实现extend_void_two_argvs
- 用 QMUI 的ExtendImplementationOfVoidMethodWithTwoArguments()
修改指定 class 的某个无返回值、带两个参数的方法实现extend_return_non_argv
- 用 QMUI 的ExtendImplementationOfNonVoidMethodWithoutArguments()
修改指定 class 的某个带返回值、无参数的方法实现extend_return_single_argv
- 用 QMUI 的ExtendImplementationOfNonVoidMethodWithSingleArgument()
修改指定 class 的某个带返回值、带一个参数的方法实现extend_return_two_argvs
- 用 QMUI 的ExtendImplementationOfNonVoidMethodWithTwoArguments()
修改指定 class 的某个带返回值、带两个参数的方法实现
Block
blockParameterInMethod
- 声明一个用于 OC 方法参数的 blockblockParameterInFunction
- 声明一个用于 C 函数参数的 blockblockproperty
- 声明一个用于 property 的 blockblocktypedef
- 用typedef
定义一个 blockblockvar
- 定义一个作为局部变量的 block
Method & Function
fnv
- 定义一个返回值为void
的方法fnv:
- 定义一个返回值为void
且带参数的方法fnblock
- 定义一个返回值类型为 block 的方法fnv_handleEvent
- 定义一个用于UIControl
事件回调的方法fnv_longPress
- 定义一个用于UILongPressGestureRecognizer
的回调方法(你就不用每次都去拼写那个很长的手势名字了)fnv_pan
- 定义一个用于UIPanGestureRecognizer
的回调方法fnv_tap
- 定义一个用于UITapGestureRecognizer
的回调方法
UIView
setFrame
- 为UIView
设置frame
setFrame_QMUI
- QMUI 使用像素对齐的CGRectFlatMake()
为UIView
设置frame
setFrameX
- QMUI 使用CGRectSetX()
修改UIView
的frame.origin.x
setFrameY
- QMUI 使用CGRectSetY()
修改UIView
的frame.origin.y
setFrameXY
- QMUI 使用CGRectSetXY()
修改UIView
的frame.origin
sizeThatFits
- 为当前 view 创建sizeThatFits:
方法layoutSubviews
- 展开layoutSubviews
方法updateConstraints
- 展开updateConstraints
方法getWidth
- 展开CGRectGetWidth()
getHeight
- 展开CGRectGetHeight()
getMinX
- 展开CGRectGetMinX()
getMinY
- 展开CGRectGetMinY()
addtarget
- 调用UIControl addTarget:action:forEvents:
方法setImageForButton
- 为UIButton
设置图片setTitleColorForButton
- 为UIButton
设置文字颜色setTitleForButton
- 为UIButton
设置文字
UITableView
initWithStyle
- 展开initWithStyle:
方法initWithStyleForCell
- 展开UITableViewCell initWithStyle:reuseIdentifier:
方法tableViewDelegate
- 展开常用的几个UITableViewDelegate
方法numberOfSectionsInTableView
- 展开numberOfSectionsInTableView:
方法numberOfRowsInSection
- 展开tableView:numberOfRowsInSection:
方法cellForRowAtIndexPath
- 展开tableView:cellForRowAtIndexPath:
方法heightForRowAtIndexPath
- 展开tableView:heightForRowAtIndexPath:
方法didSelectRowAtIndexPath
- 展开tableView:didSelectRowAtIndexPath:
方法
UICollectionView
collectionViewDelegate
- 展开常用的几个UICollectionViewDelegate
方法numberOfSectionsInCollectionView
- 展开numberOfSectionsInCollectionView:
numberOfItemsInSection
- 展开collectionView:numberOfItemsInSection:
cellForItemAtIndexPath
- 展开collectionView:cellForItemAtIndexPath:
sizeForItemAtIndexPath
- 展开collectionView:layout:sizeForItemAtIndexPath:
方法didSelectItemAtIndexPath
- 展开collectionView:didSelectItemAtIndexPath:
方法didDeselectItemAtIndexPath
- 展开collectionView:didDeselectItemAtIndexPath:
方法
UIViewController
initWithNib
- 展开initWithNibName:bundle:
方法didInitialize
- 展开某些 QMUI 控件提供的didInitialize
方法didInitializeWithStyle
- 展开 QMUICommonTableViewController 的didInitializeWithStyle:
方法loadView
- 展开loadView
方法viewDidLoad
- 展开viewDidLoad
方法viewWillAppear
- 展开viewWillAppear:
方法viewDidAppear
- 展开viewDidAppear:
方法viewWillDisappear
- 展开viewWillDisappear:
方法viewDidDisappear
- 展开viewDidDisappear:
方法viewDidLayoutSubviews
- 展开viewDidLayoutSubviews:
方法updateViewConstraints
- 展开updateViewConstraints:
方法addChildViewController
- 在当前UIViewController
里添加childViewController
removeFromParentViewController
- 将childViewController
从当前的UIViewController
里移除initSubviews
- QMUI 展开initSubviews
方法setupNavigationItems
- QMUI 重写QMUICommonViewController
里的setupNavigationItems
方法setupToolbarItems
- QMUI 重写QMUICommonViewController
里的setupToolbarItems
方法
UIBarButtonItem
backItem
- 用 QMUI 方法生成一个返回按钮boldTitleItem
- 用 QMUI 方法生成一个文字加粗的导航栏按钮closeItem
- 用 QMUI 方法生成一个导航栏上的关闭图标按钮imageItem
- 用 QMUI 方法生成一个导航栏上的图片按钮titleItem
- 用 QMUI 方法生成一个导航栏上的文字按钮
Other
pragma
- 展开一个用于 Xcode 导航的#pragma mark -
宏log
- 展开NSLog(@"xxx")
osif
- 展开一个 @available(iOS xxx, *) 的 if 判断externRefInH
- 在*.h
文件里声明一个extern const
的指针externRefInM
- 在*.m
文件里为一个extern const
的指针赋值externValueInH
- 在*.h
文件里声明一个extern const
的值变量externValueInM
- 在*.m
文件里为一个extern const
的变量赋值static reference
- 定义一个static
的指针static
- 定义一个static
的值变量__weakSelf
- 定义一个weak
的self
指针__strongSelf
- 将weakSelf
指针改为strong
的self
指针logCallStackSymbols
- 用NSLog
打出当前的方法调用栈信息timeConsuming
- 展开一段用CACurrentMediaTime()
来计算方法耗时的代码