セルをカスタマイズしたUITableViewを作成し、シミュレータで動かしてみると、上下にスクロールして再描画する際に、何の関係もないセルの値が別のセルに再描画されて、文字の上に文字が幾重にも重なり、凄いことになってしまった。それを回避するためには、セル内容作成メソッド cellForRowAtIndexPath で、サブビューを一旦取り除くことで対応できる。

// 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];
// ここまでデフォルトのまま。
// サブビューを取り除く
for (UIView *subview in [cell.contentView subviews]) {
	[subview removeFromSuperview];





	// ボタンを配置するUIViewを作成
	UIView* accessoryView =[[[UIView alloc] initWithFrame:CGRectMake(0,0,320,44)] autorelease];
	accessoryView.backgroundColor = [UIColor blackColor];

	// ボタンを作成
	UIButton* closeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
	closeButton.frame = CGRectMake(210,5,100,30);
	[closeButton setTitle:@" Close" forState:UIControlStateNormal];

	// ボタンを押したときに呼ばれる動作を設定
	[closeButton addTarget:self action:@selector(closeKeyboard:) forControlEvents:UIControlEventTouchUpInside];

	// ボタンをViewに追加
	[accessoryView addSubview:closeButton];

	// ビューをUITextFieldのinputAccessoryViewに設定
	textField.inputAccessoryView = accessoryView;


	[textField resignFirstResponder];



// ツールバーの作成
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
toolBar.barStyle = UIBarStyleBlackOpaque; // スタイルを設定
[toolBar sizeToFit];

// フレキシブルスペースの作成(Doneボタンを右端に配置したいため)
UIBarButtonItem *spacer = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil] autorelease];

// Doneボタンの作成
UIBarButtonItem *done = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closeKeyboard:)] autorelease];

// ボタンをToolbarに設定	
NSArray *items = [NSArray arrayWithObjects:spacer, done, nil];
[toolBar setItems:items animated:YES];

// ToolbarをUITextFieldのinputAccessoryViewに設定
textField.inputAccessoryView = toolBar;

[toolBar release];



Grouped Styleのテーブルで背景色を変更したところ、セクション文字色がかぶってしまって非常に見づらくなったので、タイトル色も変えた。ちなみにセクションの背景は透明にしている。


- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
UIView *headerView = [[[UIViewalloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 40)] autorelease];
tableView.sectionHeaderHeight = headerView.frame.size.height;
UILabel *label = [[[UILabelalloc] initWithFrame:CGRectMake(20, 10, headerView.frame.size.width - 20, 22)] autorelease];
label.text = [selftableView:tableViewtitleForHeaderInSection:section];
label.font = [UIFontboldSystemFontOfSize:16.0];
label.shadowOffset = CGSizeMake(0, 1);
label.shadowColor = [UIColorgrayColor];
label.backgroundColor = [UIColorclearColor];
label.textColor = [UIColorwhiteColor];

[headerView addSubview:label];
return headerView;

UITableViewのGrouped style時の背景に画像を指定する

UITableViewのGrouped style時の背景に画像を指定する。
Interface Builderでは、色は指定できても画像は指定できないので、コードで指定する。

UIColor *col = [[UIColoralloc] initWithPatternImage:[UIImageimageNamed:@"table_bg.png"]];
[col release];

Assignment writing tasks have been a great learning source that articulates the purpose and significance of it. A strong attribute of writing good assignments is to have a clear objective to express and which helps in developing a clear understanding.

A student should know the basic principles of assignment writing to arrange it accordingly. one should consider the after effects of it, for instance, What will I get after accomplishing this assignment? Anticipating the outcomes before writing actually develops a sense of responsibility, a detailed outline, a guideline and the researching requirements.
The five basic principles of writing an assignment are:
• Connecting the writing task to particular set of goals
• Always keep an eye on the rhetorical aspects related to the assignment; the audiences, writing situation and purpose
• It is obvious to define the elements related to the assignment clearly
• Ask your tutor about the grading criteria to have an idea of how deeply you have to study the subject
• Analyse each step of assignment critically and draw a manageable outline for the success accomplishment of it.
assignment writing service
1. These are the five basic principles that allow a student to accomplish any assignment successfully. Evaluating the principles, the first one is to have assignment writing purpose. It is ideal to include the assignment purpose in the first paragraph. Also, state the format of the assignment that is, a research report, case study, a problem solving paper or an abstract, etc.
2. Principle 2, evaluates three significant conditions related to assignment writing. A student should consider that the assignment is written for whom? What are the specific conditions which have to be fulfilled necessarily? And what purpose does it serve to?
3. The elements of the assignment should be stated and defined at the earliest. The reader will get your idea in a glance
4. Asking grading criteria helps a great deal in understanding the length and depth of the content; that is, to what extent you will describe and prolonged it would be.
5. Finally, draw an outline to accomplish the task successfully by justifying with each part of it.
Hopefully, this has helped you a great deal to write any type of assignment and understand its requirements.