views:

166

answers:

1

In my application,i will be displaying only one row on the uitableview initially. I want to increase the rows as user loads the previous row with data(an uiimage, here). Asof now i'm returing value 1, in numberOfRowsInSection: method, sincei don't know how to implement it in the required way. Pls help.. My cellForRowAtIndexPath method is `- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CustomCellIdentifier = @"CustomCellIdentifier";

 CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
 if (cell == nil) {
  cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CustomCellIdentifier ] autorelease];

  NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];  
  for (id currentObject in nib){
   if ([currentObject isKindOfClass:[CustomCell class]]){
    cell = (CustomCell *)currentObject;
    cell.viewController = self;
    break;
   }
  }    
 }
 if (j<15){
     cell.imageView.image = nil;
  if (count!=0)
  {
   @try{
   NSInteger row = [indexPath row];
    cell.imageView.image = [array objectAtIndex:row];
     }
   @catch (NSException* ex) {
    NSLog(@"doSomethingFancy failed: %@",ex);
   }
  }
 }
 cell.showsReorderControl = YES;
  return cell;
 [array release];

}`

that if conditon and count is nothing but just for checking the correct functioning of the mutable array, 'array'.

+1  A: 

You should read this documentation: http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView%5FiPhone/Introduction/Introduction.html

Have a look to the related samples as well.

Note: in your code [array release] won't be called since you've got a return statement just before it.

nico
thanks for the reply...
Nithin