相关疑难解决方法(0)

我可以在Objective-C switch语句中声明变量吗?

我想我会失明,因为我无法弄清楚此代码中语法错误的位置:

if( cell == nil ) {
    titledCell = [ [ [ TitledCell alloc ] initWithFrame:CGRectZero
        reuseIdentifier:CellIdentifier ] autorelease
    ];

    switch( cellNumber ) {
        case 1:
            NSString *viewDataKey = @"Name";
etc...
Run Code Online (Sandbox Code Playgroud)

当我尝试编译它时,我在最后一行的'*'标记之前收到错误:语法错误.

对不起这个基本问题,但我错过了什么?

objective-c switch-statement

57
推荐指数
2
解决办法
2万
查看次数

标签 统计

objective-c ×1

switch-statement ×1