iOS - 常用代码片

此篇博客尚不完整后续将会进行补充,如果你有更精彩的内容,请于下方评论!博主会予以补充!对您的评论博主感激不尽!

Code Snippets Xcode代码块

Code Snippets Library是Xcode中比较方便的管理代码块的功能,可以方便的用快捷方式敲出保存起来的代码,这里保存一下自己常用的Code Snippets,方便换机器或更新Xcode时取用。

1.属性Snippets

@property (strong, nonatomic) <#type#> *<#name#>;
@property (weak, nonatomic) <#type#> *<#name#>;
@property (assign, nonatomic) <#type#> <#name#>;
@property (copy, nonatomic) <#type#> *<#name#>;
@property (weak, nonatomic) id<<#delegate#>> delegate;

2.关闭自动调整ScrollView的insets

if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
self.automaticallyAdjustsScrollViewInsets = NO;
}

3.tableView

#pragma mark - tableViewDelegate,tableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return <#expression#>
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return <#expression#>
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier = <#reuse#>;

    <#Class#> *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

    if (cell == nil) {

        cell = [[[<#Class#> alloc]initWithStyle:<#(UITableViewCellStyle)#> reuseIdentifier:cellIdentifier]autorelease];
    }
    return cell;
}

4.tableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

       <#code#>

    }
    return self;
}

5.主线程

dispatch_async(dispatch_get_main_queue(), ^{
<#code#>
});

6.异步线程

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
<#code#>
});

附(常用插件、常用命令、常用路径)

1.常用插件

自己常用的插件整理:安装Alcatraz管理其他插件,在升级Xcode导致插件失效的时候能非常高效的重新安装整个插件列表


2.常用命令

  • 读取Xcode的UUID
defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

3.常用目录

  • 打开Xcode插件目录
open ~/Library/Application/Support/Developer/Shared/Xcode/Plug-ins/
  • Xcode描述文件目录
open ~/Library/MobileDevice/Provisioning/Profiles
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值