iPhone App のことなど

| | コメント(0)
Media Pickerの件は、どういうわけか、その後、動くようになりました。Appleからも再現しないとのメールが。とりあえず、Pendingにしていたアプリの登録を行いました。SDKをインストールしてすぐにデバッグして出た現象だったので、クリーンしてビルドするか、マシンを再起動するかしてみればよかったです。 「iCollage」は、既にアプリ名が登録済みだったので、「MyCollage」と変更。なおかつ、テキストと画像に角度をつけられるように、また画像のアルファ値を変更できるようにしてから登録しました。 「Wakeup Tunes」は登録後、Appleから連絡があって、リストから「編集・削除」で削除できないとのこと。これは、3.0から動作が変わっているのですよね。エリカ本の3.0以前のコードは次のようになっています。


// Initialize and set up the table title array
- (HelloController *) init
{
	if (![self = [super init]]) return self;
	self.title = @"Table Edits";
	tableTitles = [[NSMutableArray alloc] init];
	ithTitle = NCELLS;
	for (int i = 1; i <= NCELLS; i++)
		[tableTitles addObject:[NSString stringWithFormat:@"Table Cell #%d", i]];
	return self;
}

// Finished with edit mode, so restore the buttons and commit changes
-(void)leaveEditMode
{
// Add the edit button
	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
	initWithTitle:@"Edit"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(enterEditMode)]
	autorelease];
	[self.tableView endUpdates];
	[self.tableView setEditing:NO animated:YES];

}
// Handle deletion requests
- (void)tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath
{
	printf("About to delete item %d\n", [indexPath row]);
	[tableTitles removeObjectAtIndex:[indexPath row]];
	[tableView reloadData];
}
// Enter edit mode by changing "Edit" to "Done"
-(void)enterEditMode
{
// Add the edit button
	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
	initWithTitle:@"Done"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(leaveEditMode)]
	autorelease];
	[self.tableView setEditing:YES animated:YES];
	[self.tableView beginUpdates];
}
// Initialize the view with its buttons
- (void)loadView
{
	[super loadView];
	// Add an add button
	self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]
	initWithTitle:@"New"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(add)] autorelease];
	// Add the edit button
	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
	initWithTitle:@"Edit"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(enterEditMode)]
	autorelease];
}


3.0以降は次のようになります。


// Initialize and set up the table title array
- (HelloController *) init
{
	if (![self = [super init]]) return self;
	self.title = @"Table Edits";
	tableTitles = [[NSMutableArray alloc] init];
	ithTitle = NCELLS;
	for (int i = 1; i <= NCELLS; i++)
		[tableTitles addObject:[NSString stringWithFormat:@"Table Cell #%d", i]];
	return self;
}

// Finished with edit mode, so restore the buttons and commit changes
-(void)leaveEditMode
{
// Add the edit button
	self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
	initWithTitle:@"Edit"
	style:UIBarButtonItemStylePlain
	target:self
	action:@selector(enterEditMode)]
	autorelease];
	
//[self.tableView endUpdates];
[self.tableView setEditing:NO animated:YES];
[tableView reloadData];
} // Handle deletion requests - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { printf("About to delete item %d\n", [indexPath row]); [tableTitles removeObjectAtIndex:[indexPath row]];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
//[tableView reloadData];
} // Enter edit mode by changing "Edit" to "Done" -(void)enterEditMode { // Add the edit button self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(leaveEditMode)] autorelease]; [self.tableView setEditing:YES animated:YES];
//[self.tableView beginUpdates];
} // Initialize the view with its buttons - (void)loadView { [super loadView]; // Add an add button self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"New" style:UIBarButtonItemStylePlain target:self action:@selector(add)] autorelease]; // Add the edit button self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStylePlain target:self action:@selector(enterEditMode)] autorelease]; }

カテゴリ

コメントする


画像の中に見える文字を入力してください。

このブログ記事について

このページは、kawaguchiが2009年6月21日 10:32に書いたブログ記事です。

ひとつ前のブログ記事は「ザ・モンキーズ」です。

次のブログ記事は「近況20090624」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

Powered by Movable Type 4.0

Twitter