strange problem with UITableView

Discussion in 'iOS Programming' started by moomy, Oct 18, 2010.

  1. moomy macrumors newbie

    Joined:
    Apr 28, 2010
    #1
    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
    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
     

    Attached Files:

  2. moomy thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #2
    Hi guys,
    tried to delete this as i have worked it out. The issue was in interface builder rather than the code.

    not sure how to delete a thread though.

    thanks
    mooms
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3

    You can't. Moderators can but in general only do so if there is a good reason. If you want a moderator to look at deleting the thread report the first post yourself (using the little warning triangle) and explain why you want the thread deleted.
     
  4. moomy thread starter macrumors newbie

    Joined:
    Apr 28, 2010
    #4
    no problem,
    just didn't want it clogging up the forum.
    :)
     
  5. Luke Redpath macrumors 6502a

    Joined:
    Nov 9, 2007
    Location:
    Colchester, UK
    #5
    Or...you could explain what the problem was and how you solved it for the benefit of others. Just saying...;)
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Which is the root reason that threads tend not to be deleted: they are a searchable resource.
     

Share This Page