美文网首页
项目问题记录

项目问题记录

作者: Unlimitzzh | 来源:发表于2016-10-17 09:53 被阅读23次

按钮调整布局

- (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;

设置部分字段不同字体颜色

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];
    //设置字号
    [str addAttribute:NSFontAttributeName value:font range:range];
    //设置文字颜色
    [str addAttribute:NSForegroundColorAttributeName value:vaColor range:range];
    
    label.attributedText = str;
}

tableView去除多余行

_tableView.tableFooterView = [[UIView alloc]init];

导航跳转到某一个控制器

for (UIViewController *temp in self.navigationController.viewControllers) {
                    if ([temp isKindOfClass:[SuyanSDKMessageController class]]) {
                        [self.navigationController popToViewController:temp animated:YES];
                    }
                }

导航条自定义跳转

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侧滑

-(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:@"取消关注" 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:^{
 }];

相关文章

  • 记录项目问题总结

    本来这种事情是没有我什么事情的,只是因为昨天吐槽的太多,吐槽的我都不知道我在吐槽神马,汪汪汪!上头很无奈的说,明天...

  • 项目问题记录

    按钮调整布局 搜索框键盘下落 设置部分字段不同字体颜色 tableView去除多余行 导航跳转到某一个控制器 导航...

  • 项目问题记录

    一、Git问题我们自己制作的第三方库如果没有发布到Cocoapods上,而我们又要在Podfile中引用,那么我们...

  • 项目问题记录

    在做企业项目时遇到的问题记录: 问题一:在写这个ul代码时遇到设置float:left,float:right无法...

  • 项目问题记录

    1、有关cell的问题给cell赋值tag不能直接这样赋值'cell.tag= indexPath.row',这样...

  • AAPT: error: resource attr/motio

    问题记录 记录项目中的一个问题,不知什么时候,运行项目会出现这个错误: 解决方法 buildscript { ...

  • iOS 运行报错笔记

    纯个人记录运行项目报错笔记记录 一、问题1 解决办法:问题原因:导入库引入问题解决的办法就是在项目的target里...

  • RABC项目问题记录

    新建项目 新建maven开始项目的时候,会报错,因为没有webxml.项目右击-properties,projec...

  • 项目Swing问题记录

    1、Swing的基本概念是什么? 答:Swing是java中的GUI工具包。是为解决AWT存在的问题而新开发的图形...

  • 【日常项目问题记录】

    1.window api window.atob() 用于解码使用 base-64 编码的字符串 window....

网友评论

      本文标题:项目问题记录

      本文链接:https://www.haomeiwen.com/subject/qrmayttx.html