Hi there,
I have a UITableView which is behaving strangely. When I scroll down beyond item 8 (ie off the bottom of the page) The lines between my cells disappear, also the blue highlight bar goes strange. It sticks on line 8 and only highlights later selections briefly.
here is a pic, notice that the fine line between strings disappears, this is scrolled down a bit.
here is the code m file
I have looked in a couple of books and at some source code and this seems to be a common way to do it so I'm not quite sure what's missing??
Any help would be amazing. Thanks
I have a UITableView which is behaving strangely. When I scroll down beyond item 8 (ie off the bottom of the page) The lines between my cells disappear, also the blue highlight bar goes strange. It sticks on line 8 and only highlights later selections briefly.
here is a pic, notice that the fine line between strings disappears, this is scrolled down a bit.
here is the code m file
Code:
#import "MiddleViewController.h"
#import "FinalViewController.h"
@implementation MiddleViewController
@synthesize myList;
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return myList.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.text = [myList objectAtIndex:indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
FinalViewController *anotherViewController = [[FinalViewController alloc] initWithNibName:@"FinalViewController" bundle:nil];
anotherViewController.title = [tableView cellForRowAtIndexPath: indexPath].textLabel.text;
anotherViewController.myLabel = [NSString stringWithFormat:@"%@",
anotherViewController.title];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end
I have looked in a couple of books and at some source code and this seems to be a common way to do it so I'm not quite sure what's missing??
Any help would be amazing. Thanks