错误:NsIvalidArgumentException [_NSCFConstantString ObjectAtIndex:]:

时间:2012-10-15 07:10:21

标签: ios ios5 uitableview core-bluetooth

我在视图中使用表视图.tableviewcell仅在行中显示相同的数据。我在视图控制器中有操作按钮。如果按下按钮,则表格中显示的输出是概念。我不知道如何将字符串分配为数组。我正在使用设备作为nsarray

- (void)viewDidLoad{
 [super viewDidLoad];
 self.label.text = @"";
 device=[[NSString alloc]init];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {   
 return 2;
 }
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{


static NSString *CellIdentifier=@"Cell";
//cell = [tableView dequeueReusableCellWithIdentifier:cellID];
//if (!cell)
    //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID] autorelease];



UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil)
{
    cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

}


   cell.textLabel.text=[NSString stringWithFormat:@"%@",device];
   cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
    return cell;
 }

-(void)peripheralManagerDidConnectPeripheral:(PeripheralManager *)manager
{
device = [NSString stringWithFormat:@" %@", manager.deviceName];
[self.deviceTable reloadData];
}

0 个答案:

没有答案
相关问题