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;
}
現在是什麼讓我的任務困難是我有一個標籤欄控制器,它是應用程序委託中的子視圖,並且我在導航控制器中包裝了表格視圖,當點擊一個單元格時,拾取器視圖,反過來一旦按下按鈕,應該返回到表格視圖,單元格填充食物選擇。
任何人都可以幫助而不必恢復到單身或涉及應用程序委託?
謝謝,我等待着你聰明的解決辦法,高興:)
崔佛