私はペーストボードアイテムはペーストボードのアイテムをテーブルにコピーする方法は?
たの詳細ビューにドリルダウンし テーブルにコピーし、すべてのペーストボードアイテム、アプリケーションを作成になっていますどこ私はここで割り当てを持っています
。
以下、私は
RootViewController.m
ファイルのコードを提供します。プログラムは動作せず、この行にSIGABRT
というエラーが表示されますcell.textLabel.text = cellValue;
。 ここで間違っている可能性があり、事前に感謝してください。#import "RootViewController.h" @implementation RootViewController @synthesize detailsViewController; NSArray* pasteBoardItems; - (void)viewDidLoad { // Get a reference to the system pasteboard UIPasteboard* pasteBoard = [UIPasteboard generalPasteboard]; NSLog(@"%@", pasteBoard.items); pasteBoardItems = [pasteBoard.items valueForKey:@"public.utf8-plain-text"]; pasteBoardItems = [pasteBoard.items valueForKey:@"public.item (kUTTypeItem)"]; self.navigationItem.title = @"Pasteboard"; [super viewDidLoad]; } - (void)dealloc { [pasteBoardItems release]; [super dealloc]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [pasteBoardItems count]; } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } NSString *cellValue = [pasteBoardItems objectAtIndex:indexPath.row]; cell.textLabel.text = cellValue; // Configure the cell. return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; NSString *rowValue = [pasteBoardItems objectAtIndex:row]; NSString *message = [[NSString alloc] initWithFormat:@"You have selected \"%@\"",rowValue]; if(self.detailsViewController == nil){ DetailsViewController *d = [[DetailsViewController alloc] initWithNibName:@"DetailsViewController" bundle:[NSBundle mainBundle]]; self.detailsViewController = d; [d release]; } [self.detailsViewController initWithTextSelected:message]; [self.navigationController pushViewController:self.detailsViewController animated:YES]; } @end
この質問はプログラミングに関するものであり、スタックエクスチェンジにあるべきです - 私は司会者がそれを移動するようにフラグを立てています – Mark