按鈕調(diào)整布局
- (void)layoutSubviews {
[super layoutSubviews];
self.imageView.frame = CGRectMake(20, 20, [UIScreen mainScreen].bounds.size.width / 4 - 45, [UIScreen mainScreen].bounds.size.width / 4 - 45);
self.titleLabel.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.width / 4 - 25, [UIScreen mainScreen].bounds.size.width / 4, 25);
}
搜索框鍵盤下落
_collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
設(shè)置部分字段不同字體顏色
NSRange range = [cell.titleLabel.text rangeOfString:_searchString options:NSCaseInsensitiveSearch];
[self setTextColor:cell.titleLabel FontNumber:cell.titleLabel.font AndRange:range AndColor:[UIColor colorWithRed:0/255.0 green:188/255.0 blue:212/255.0 alpha:1]];
-(void)setTextColor:(UILabel *)label FontNumber:(id)font AndRange:(NSRange)range AndColor:(UIColor *)vaColor
{
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:label.text];
//設(shè)置字號
[str addAttribute:NSFontAttributeName value:font range:range];
//設(shè)置文字顏色
[str addAttribute:NSForegroundColorAttributeName value:vaColor range:range];
label.attributedText = str;
}
tableView去除多余行
_tableView.tableFooterView = [[UIView alloc]init];
導(dǎo)航跳轉(zhuǎn)到某一個(gè)控制器
for (UIViewController *temp in self.navigationController.viewControllers) {
if ([temp isKindOfClass:[SuyanSDKMessageController class]]) {
[self.navigationController popToViewController:temp animated:YES];
}
}
導(dǎo)航條自定義跳轉(zhuǎn)
NSMutableArray *array = [NSMutableArray array];
[self.navigationController.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[XBHomeViewController class]]) {
[array addObject:obj];
}
}];
XBMyOrderViewController *detailVC = [XBMyOrderViewController controller];
[array addObject:detailVC];
[self.navigationController setViewControllers:array animated:YES];
自定義cell側(cè)滑
-(void)layoutSubviews
{
[super layoutSubviews];
for (UIView *subView in self.subviews){
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]){
UIButton* deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
deleteBtn.frame = subView.bounds;
[deleteBtn setTitle:@"取消關(guān)注" forState:UIControlStateNormal];
[deleteBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
[deleteBtn setTitleColor:[UIColor colorWithRed:253/255.0 green:206/255.0 blue:7/255.0 alpha:1] forState:UIControlStateNormal];
deleteBtn.backgroundColor = [UIColor colorWithRed:245/255.0 green:245/255.0 blue:245/255.0 alpha:1];
[subView addSubview:deleteBtn];
break;
}
}
}
present頁面全部dismiss
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:^{
}];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。