无法从数组中获取indexPath.row(错误indexPath unclared)?
我在我的.h中宣布了一个NSArray
@interface DevicePreferencesController : UITableViewController < UIAlertViewDelegate >{
NSArray *plist;
UITextField *deviceName;
}
此数组用于从URL加载plist数据
这是我得到的plist
plist:(
{
category = 11;
id = 1;
name = light1;
},
{
category = 11;
id = 5;
name = window;
},
{
category = 12;
id = 2;
name = dimmer2;
},
{
category = 23;
id = 3;
name = win;
}
)
我用tableView显示它
如果我选择了细胞
它会弹出一个带有textField的alertView,它可以重命名plist中的数据
这是alertView的按钮操作
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if ([alertView tag]==1) {
if (buttonIndex == 1){
[request setPostValue:[[self.plist objectAtIndex:indexPath.row] valueForKey:@"id"] forKey:@"id"];
[request setPostValue:deviceName.text forKey:@"name"];
[request startSynchronous];
}
}
}
但我在这里得到错误“indexPath”未声明!
为什么? plist是一个数组,为什么我不能从数组中获取indexPath?
没有找到相关结果
已邀请:
2 个回复
粳饶瓢部
献导外拘