#warning Incomplete method implementation怎么修改?
2015-07-08 21:46
471 查看
#warning Incomplete method implementation怎么修改?
各位朋友,我在做一个表格视图的例子,在tableview方法里总有几个warning:
#warning Incomplete method implementation
或
#warning potentially Incomplete method implementation
这个方法我修改了下,绝对是没有问题的,但是warning总消不掉,但可以正常编译运行。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
// Return the number of rows in the section.
return [self.File count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath/////#warning potentially method implementation.
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
} /////////#warning Incomplete method implementation.
cell.textLabel.text = [self.File objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// Configure the cell...
return cell;
}
请各位大大审阅下
从Xcode 4开始,建立TableViewController,自动生成的代码都会自动来上这两行,目的是警告开发者需要完成numberOfRows、numberOfSections等方法的实现。看你的代码,已经完成了相关工作,这个时候就可放心的把#warning ...行删除掉,再编译的时候就会没有警告了。
同理,在我们开发过程中,对不确定、错误、bug、待定的代码,也可手工插入#warning行,在编译的时候提醒自己需要处理的地方。
各位朋友,我在做一个表格视图的例子,在tableview方法里总有几个warning:
#warning Incomplete method implementation
或
#warning potentially Incomplete method implementation
这个方法我修改了下,绝对是没有问题的,但是warning总消不掉,但可以正常编译运行。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
// Return the number of rows in the section.
return [self.File count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath/////#warning potentially method implementation.
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
} /////////#warning Incomplete method implementation.
cell.textLabel.text = [self.File objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
// Configure the cell...
return cell;
}
请各位大大审阅下
从Xcode 4开始,建立TableViewController,自动生成的代码都会自动来上这两行,目的是警告开发者需要完成numberOfRows、numberOfSections等方法的实现。看你的代码,已经完成了相关工作,这个时候就可放心的把#warning ...行删除掉,再编译的时候就会没有警告了。
同理,在我们开发过程中,对不确定、错误、bug、待定的代码,也可手工插入#warning行,在编译的时候提醒自己需要处理的地方。
相关文章推荐
- Leetcode 171 Excel Sheet Column Number
- OpenStack之二
- CSS3 transition 属性
- 23从上往下打印二叉树
- 22个值得收藏的android开源代码-UI篇
- Search in Rotated Sorted Array II
- C++强制类型转换方法
- 黑马程序员---Java 数组(三)
- 《算法导论》 - 第6章 - 堆排序 - 习题解答
- 《算法导论》 - 第6章 - 堆排序 - 习题解答
- 面试题3:二维数组中的查找
- 【读书笔记】【01】 《不敢止步~一个软件工匠的12年》
- js调用后台,后台调用前台等方法总结
- leetcode 50题总结
- jquery插件--多行文本缩略
- 使用C++ tinyxml2库
- UISearchBar控件
- eclipse 错误failed to load the jni shared library C:program files/java/ server/jvm.dll
- 基于触发机制的脚本系统
- crm操作观点