Xcode常用代码块整理 您所在的位置:网站首页 xcode整理代码快捷键 Xcode常用代码块整理

Xcode常用代码块整理

2023-09-24 17:45| 来源: 网络整理| 查看: 265

一、屏幕尺寸 //快捷键 Screen Size

/** 屏幕尺寸参数 */ #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

二、初始化函数 //快捷键 initBase

#pragma mark - **************** 初始化操作 - (void)initBaseData { } - (void)initBaseView { }

三、属性 strong、copy,assign //快捷键:strongg 、 copyy 、assignn

//@property(nonatomic,strong) * //@property(nonatomic,copy) * //@property(nonatomic,assign)

四、tableview创建 //快捷键 tableViewDelegate

#pragma mark lazy loading... -(UITableView *)tableView { if (!_tableView) { _tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; } return _tableView; } #pragma tableView--delegate #pragma tableView -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identify = @"cellIdentify"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identify]; if (!cell) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identify]; } cell.textLabel.text = self.arrayTitle[indexPath.row]; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { }

五、webview创建 //快捷键 webView delegate

#pragma mark--webView -(UIWebView *)webView { if (!_webView) { _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, SCREEN_HEIGHT)]; _webView.scalesPageToFit = YES; _webView.delegate = self; _webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } return _webView; } #pragma mark--webview的delegate /** start */ -(void)webViewDidStartLoad:(UIWebView *)webView { } /** start loading */ -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return YES; } /** finish */ -(void)webViewDidFinishLoad:(UIWebView *)webView { } /** error */ -(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { }

六、button创建 //快捷键 button create

#pragma mark--button create UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(100, 100, 100, 50); btn.backgroundColor = [UIColor orangeColor]; [btn addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn];

七、注释

/** */ 快捷键 explain property // -- 快捷键 explain single #pragma mark - **************** 快捷键 explain mark

快捷键说明

八、待处理事项 //快捷键 waring

#warning TODO 目前先整理这些,后续遇到再补加。


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有