0
imは文字列を別のビューに渡しますが、成功しません。文字列をテーブルセルビューに渡す
私はボタンでピッカー持っている:私は、テーブルセルの描画を使用して別のビューに 'メッセージ' を渡したい
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;
}
今私の仕事が難しくなっているのは、アプリケーションデリゲートのサブビューであるタブバーコントローラーがあり、セルをクリックするとnavコントローラでテーブルビューをラップした一度ボタンが押されると、順番に、ピッカービューがアップされ、セルが選択されたセルでテーブルビューに戻ります。
誰かがシングルトンに戻ったり、アプリケーションデリゲートに関わることなく手助けできますか?
おかげで、私は歓喜のあなたの巧妙な回避策:)
を待つTREV