0
尝试将字符串传递到另一个视图但没有成功。将字符串传递给表格单元格视图
我有一个按钮选择器:
picker.m
@synthesize marray2, marray1;
-(IBAction)show:(id)sender
{
NSInteger breadRow = [mpicker selectedRowInComponent:kBreadComponent];
NSInteger fillingRow = [mpicker selectedRowInComponent:kFillingComponent];
NSString *bread = [self.marray2 objectAtIndex:breadRow];
NSString *filling = [self.marray1 objectAtIndex:fillingRow];
NSString *message = [[NSString alloc] initWithFormat:@"Your %@ and %@ will be right up.", filling, bread];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" Thank you " message:message delegate:nil cancelButtonTitle:@" OK " otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
我想通过 '消息',其使用表单元格图的另一视图:
(摘自FoodOutput .M):
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
MyIdentifier = @"tblCellView";
TableCellView *cell = (TableCellView *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"TableCellView" owner:self options:nil];
cell = tblCell;
}
/*if(message== nil){ food = [[NSMutableArray alloc] initWithObjects:@"choose your food", nil];} else {food = [[NSMutableArray alloc] initWithObjects:[self message],nil];}*/
arrayNum = [[NSArray alloc] initWithObjects:[NSString stringWithFormat:@"%d", indexPath.row+1],nil];
//This is where i want to use message from the other view:
[cell setLabelText:message];
//But that doesn't work???????
[cell setLabelRowNum :[arrayNum objectAtIndex:0]];
return cell;
}
现在是什么让我的任务困难是我有一个标签栏控制器,它是应用程序委托中的子视图,并且我在导航控制器中包装了表格视图,当点击一个单元格时,拾取器视图,反过来一旦按下按钮,应该返回到表格视图,单元格填充食物选择。
任何人都可以帮助而不必恢复到单身或涉及应用程序委托?
谢谢,我等待着你聪明的解决办法,高兴:)
崔佛