1.快捷创建ImageView
UIImageView *<#imageViewName#> = [[UIImageView alloc] initWithFrame:CGRectMake(<#x#>, <#y#>, <#width#>, <#height#>)];
<#imageViewName#>.layer.masksToBounds = YES;
<#imageViewName#>.layer.cornerRadius = <#imageViewName#>.width/2;
<#imageViewName#>.image = [UIImage imageNamed:@"<#imageName#>"];
[self addSubview:<#imageViewName#>];
2.快捷创建Iabel
UILabel *<#labelName#> = [[UILabel alloc] initWithFrame:CGRectMake(<#x#>, <#y#>, <#width#>, <#height#>)];
<#labelName#>.textColor = <#textColor#>;
<#labelName#>.font = [UIFont systemFontOfSize:16];
<#labelName#>.textAlignment = NSTextAlignmentCenter;
[self addSubview:<#labelName#>];
3.快捷创建UIButton
UIButton *<#buttonName#> = [[UIButton alloc]initWithFrame:CGRectMake(<#x#>, <#y#>, <#width#>, <#height#>)];
[<#buttonName#> setTitleColor:<#titleColor#> forState:UIControlStateNormal];
[<#buttonName#> setTitle:@"" forState:UIControlStateNormal];
<#buttonName#>.titleLabel.font = [UIFont systemFontOfSize:<#fontSize#>];
[<#buttonName#> addTarget:self action:@selector(startTime:) forControlEvents:UIControlEventTouchUpInside];
<#buttonName#>.layer.cornerRadius = 2;
<#buttonName#>.layer.masksToBounds = YES;
<#buttonName#>.backgroundColor = <#color#>;
[self.view addSubview:<#buttonName#>];
4.快捷创建属性
/**
 *  <#注释#>
 */
@property (nonatomic,strong) <#class#> *<#name#>;
5.快捷创建table
-(UITableView *)<#tableName#>{
   
    if (!_<#tableName#>) {
        _<#tableName#> = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWith, kScreenHeight) style:UITableViewStylePlain];
        _<#tableName#>.dataSource = self;
        _<#tableName#>.delegate = self;
        _<#tableName#>.rowHeight = <#rowHeight#>;
        _<#tableName#>.tableHeaderView = <#headView#>;
        _<#tableName#>.tableFooterView = [[UIView alloc] init];
    }
    return _<#tableName#>;
}
6.快捷创建table数据源
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
   
    return <#arrayName#>.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
   
    static NSString *identifier = @"cell";
   
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
   
    if (!cell) {
       
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
       
        cell.selectionStyle = UITableViewCellSelectionStyleDefault;
    }
   
    cell.model = <#arrayName#>[indexPath.row];
   
    return cell;

}
7.快捷创建table代理
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
   
}

xcode快捷创建控件相关推荐

  1. java控件数组_在C# WinForm程序中创建控件数组及相应的事件处理

    控件数组是VB提供的一个优秀的设计解决方案,它能很方便快捷的处理大批同类控件的响应和时间处理,但不知为什么在C#中这个优秀特性没有传承下来,甚为可惜,本文将要探讨就是如何在C# WinForm程序实现 ...

  2. 在 Visual Basic .NET 和 Visual C# .NET 中创建控件数组

    在 Visual Basic .NET 和 Visual C# .NET 中创建控件数组 摘要:本文介绍如何使用 Visual Basic® .NET 和 Visual C#™ .NET 创建和管理控 ...

  3. C#线程间操作无效: 从不是创建控件 XX 的线程访问它

    转自:http://www.arasplm.net/index.php/zh/community/myblog/c-xx-.html 前些天做的要使用到线程的项目,现在和大家分享一下感受! 以下面小列 ...

  4. 黄聪:BackGroundWorker解决“线程间操作无效: 从不是创建控件的线程访问它” (C# VS2008)...

    在编程中经常会遇到在一个按钮中执行复杂操作,并将复杂操作最后返回的值加入一个ListView或ComboBox中候选.这个时候程序会卡,当程序员将这些卡代码放进线程(Thread)中后发现当对控件操作 ...

  5. 线程间操作无效: 从不是创建控件的线程访问它

    转自原文 线程间操作无效: 从不是创建控件的线程访问它. using System; using System.Collections.Generic; using System.ComponentM ...

  6. 线程间操作无效:从不是创建控件的线程访问它的三种方法

    访问 Windows 窗体控件本质上不是线程安全的.如果有两个或多个线程操作某一控件的状态,则可能会迫使该控件进入一种不一致的状态.还可能出现其他与线程相关的 bug,包括争用情况和死锁.确保以线程安 ...

  7. 用委托在listbox中异步显示信息,解决线程间操作无效,从不是创建控件的线程访问它...

    //创建一个委托,是为访问listbox控件服务的.public delegate void UpdateTxt(string msg);//定义一个委托变量public UpdateTxt upda ...

  8. asp.net 包含动态创建控件的容器如果要切换显示/隐藏不要用 Visible 属性

    asp.net 包含动态创建控件的容器如果要切换显示/隐藏不要用 Visible 属性 就是不用 XXX.Visible = false;  // true 因为这样该容器及其子控件会彻底的从页面上消 ...

  9. 在.NET上如何根据字符串动态创建控件

    在.Net上用字符串动态创建控件是通过反射来实现. 首先,利用System.Type.GetType方法,获得字符串中指定的控件的类型实例. 这里需要注意这个字符串的语法,根据msdn的解释: 按名称 ...

  10. MFC动态创建控件并响应事件代码实现过程

    MFC动态创建控件以及响应动态创建的控件的事件的实现方法如下. 1.创建对象     用new进行动态创建一个对象.然后调用Create函数创建窗口,在函数的父窗口参数中传入this或者用AfxGet ...

最新文章

  1. usaco Palindromic Squares
  2. Java 基础 之 continue和 break
  3. Python Web 框架:Django MVC搭建
  4. 广域网智能流量调度—Vecloud
  5. NOJ---1408----map的运用
  6. VTK:可视化之Cursor3D
  7. SQL SERVER查询时间条件式写法
  8. aix 安装oracle9,IBM P570 小型机AIX5.3系统安装ORACLE9i
  9. mysql 客户服务号_mysql客户端及服务端常用实用工具功能总结
  10. 边缘AI计算新时代,人工神经网络秒变脉冲神经网络
  11. python mssql bulk_SqlBulkCopy:批量插入SqlServer的利器
  12. Windows Terminal Preview 1910 发布
  13. 判断是否是微信浏览器还是企业微信浏览器
  14. 计算机无法添加用户名或密码错误,win10系统无法登录网络打印机提示未知的用户名或者密码错误的设置技巧...
  15. 游戏辅助制作核心--植物大战僵尸逆向之植物叠加种植(八)
  16. Python数据分析之股票数据
  17. Gitea:私有部署Git托管服务(私有Git仓)
  18. Google秘密入口
  19. 【爱生活之咖啡】咖啡入坑记--咖啡豆的那些事
  20. gridView---->列标题右键菜单管理

热门文章

  1. eclipse安装spring boot插件spring tool suite
  2. System.ComponentModel.Win32Exception (0x80004005):拒绝访问。——解决办法
  3. WPF学习笔记-如何按ESC关闭窗口
  4. CoreData 增删改查
  5. HashMap的key可以是可变的对象吗???
  6. C# 从文本列中检索数据
  7. iOS 实现搜索关键字高亮
  8. 校园推广方案:常用手段及百试不爽的方法
  9. 在国内使用maven下载jar包非常慢的解决方法
  10. java编程思想--协变返回类型