我尝试将标签值传递给另一个视图。我使用表格视图和表格视图放置标签。代码......
如
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier = [NSString stringWithFormat:@"%i %i",indexPath.row,indexPath.section];
UITableViewCell *cell =[self.tableViewdequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
NSMutableArray *arr=[NSMutableArray arrayWithArray:[finalArray objectAtIndex:indexForAll]];
NSLog(@"-=-= arr count %d -=-====",[arr count]);
NSLog(@"%@",[[arr objectAtIndex:indexPath.row]description]);
NSLog(@"-====== row value %d -=======",indexPath.row);
NSLog(@"--=-=--- strike value %@",[[arr objectAtIndex:indexPath.row]valueForKey:@"Strike"]);
//indexForAll=indexPath.row
cell.accessoryType = UITableViewCellAccessoryNone;
cell.highlighted = YES;
NSMutableArray *arr2=[NSMutableArray arrayWithArray:[arr objectAtIndex:indexPath.row]];
NSLog(@" -=-=-=-= Arr2 value : %d ",[arr2 count]);
NSLog(@"%@",[arr2 description]);
//.......................................Strike value.....................................//
UILabel *label1;
label1 =[[UILabel alloc]initWithFrame:CGRectMake(10, 3,50, 15)];
NSLog(@"-=-=--= lable1 value -%@",[[arr2 objectAtIndex:0]valueForKey:@"Strike"]);
[label1 setText:[NSString stringWithFormat:@"%@",
[[arr2 objectAtIndex:0]valueForKey:@"Strike"]]];
label1.textAlignment = UITextAlignmentCenter;
[label1 setFont:[UIFont fontWithName:@"Helvetica" size:12]];
[label1 setTextColor:[UIColor blackColor]];
[cell.contentView addSubview:label1];
NSLog(@"lable1 addded");
[self.tableView reloadData];
我想给 label1 值获取另一个视图。我有过尝试但甚至没有成功。如果有帮助,谢谢
我试过这样
AppDelegate_iPhone *appDelegate = (AppDelegate_iPhone *)[[UIApplication sharedApplication] delegate];
但价值不及格。