Git Product home page Git Product logo

singlelinelayoutcell-cell-'s Introduction

SingleLineLayoutCell

  • 工欲善其事,必先利其器。面对各种各样的单行cell,虽然代码写起来不难,但是还是比较繁琐的,浪费时间。怎么样用一种cell直接搞定这些乱七八糟的样式,实现快速高效的实现。详情请看demo源码,以下是效果图以及使用方法。欢迎各位提出建议,指导,star。

效果图

1.gif

示例用法

   //弹窗,标题,子标题,图标,右侧箭头
   {
        SingleLineLayoutItem *item0 = [SingleLineLayoutItem itemWithTitle:@"弹窗" subtitle:@"subtitle" icon:@"3" rightType:SingleLineItemRightTypeArrow];
        item0.iconWidth = 30;
        item0.operation = ^{
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"It is so cool" message:@"Hello World !!! " delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
            [alertView show];
        };
    }
    
    //push,标题,右侧箭头
    {
        SingleLineLayoutItem *item1 = [SingleLineLayoutItem itemWithTitle:@"push到下一控制器" rightType:SingleLineItemRightTypeArrow];
        __weak typeof(self) weakSelf = self;
        item1.operation = ^{
            UIViewController *vc = [[UIViewController alloc] init];
            vc.view.backgroundColor = [UIColor cyanColor];
            [weakSelf.navigationController pushViewController:vc animated:YES];
        };
    }
    
    //标题,子标题,图标,右侧自定义视图为UIImageView
    {
        SingleLineLayoutItem *item2 = [SingleLineLayoutItem itemWithTitle:@"标题2" subtitle:@"the subtitle length is so long . oh my god" icon:@"4" rightType:SingleLineItemRightTypeCustomView];
        item2.iconWidth = 30;
        UIImageView *icon = [[UIImageView alloc] init];
        icon.image = [UIImage imageNamed:@"4"];
        icon.size = CGSizeMake(30, 30);
        item2.rightView = icon;
        [_dataArray addObject:item2];
    }
    
    //标题,右侧TypeCheck
    {
        SingleLineLayoutItem *item3 = [SingleLineLayoutItem itemWithTitle:@"这个标题有点长。真的有点长"  rightType:SingleLineItemRightTypeCheck];
        [_dataArray addObject:item3];
    }
    
    //标题,子标题,图标,右侧箭头,右侧自定义视图为UILabel
    {
        SingleLineLayoutItem *item4 = [SingleLineLayoutItem itemWithTitle:@"我的收藏(99)" subtitle:@"详细信息" icon:@"" rightType:SingleLineItemRightTypeArrowAndCustomView];
        UILabel *rightLabel = [[UILabel alloc] init];
        rightLabel.font = [UIFont systemFontOfSize:13];
        rightLabel.text = @"右侧自定义的视图";
        rightLabel.textColor = [UIColor orangeColor];
        [rightLabel sizeToFit];
        item4.rightView = rightLabel;
    }
    
     //带富文本的标题,子标题,右侧自定义视图为UISwitch
    {
        SingleLineLayoutItem *item5 = [SingleLineLayoutItem itemWithTitle:@"我的消息(5)" subtitle:@"详细信息" rightType:SingleLineItemRightTypeCustomView];
        item5.titleAttributes = @{NSForegroundColorAttributeName : [UIColor redColor]};
        item5.subTitleAttributes = @{NSForegroundColorAttributeName : [UIColor cyanColor]};
        item5.rightView = [[UISwitch alloc] init];
    }

TextInputCell

2.gif

示例用法

    TextInputItem *receiverItem = [TextInputItem textInputItemWithPlaceholder:@"请输入收货人姓名" text:nil];
    
    TextInputItem *phoneItem = [TextInputItem textInputItemWithWithTitle:@"手机号: " Placeholder:@"请输入11位手机号" text:@"13000000000"];
    //设置弹出键盘的样式
    phoneItem.keyboardType = UIKeyboardTypeNumberPad;
    
    TextInputItem *detailAddressItem = [TextInputItem textInputItemWithTitle:@"详细地址: " Placeholder:@"请输入详细地址" textInputType:TextInputTextView];

singlelinelayoutcell-cell-'s People

Contributors

13662049573 avatar

Watchers

James Cloos avatar 小唐羽锋 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.