2012-06-02 35 views
-2

hello。我建立我的應用程序,我在consule查看此錯誤:UITableView Cells

警告:由於使用傳統的單元佈局委託執行的tableView的:accessoryTypeForRowWithIndexPath:英寸請移除此方法的實施並將單元格屬性accessoryType和/或editingAccessoryType設置爲移至新單元格佈局行爲。此方法將不再在將來的版本中調用。

代碼爲:

 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
    { 
    return 1; 
     } 

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
    { 
     return [name count]; 
    } 


    // 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] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
    } 

    // Set up the cell... 
    NSString *cellValue = [name objectAtIndex:indexPath.row]; 
    cell.textLabel.text = cellValue; 
    /*NSString *trimmedString = [[listOfItems objectAtIndex:indexPath.row] stringByReplacingOccurrencesOfString:@" " withString:@"%20"]; 
    NSString *website4 = [NSString stringWithFormat:@"http://shaymargolisapps.x10.mx/send.php?mission=GetImageOfApp&aname=%@", trimmedString]; 
    NSData *dataURL4 = [NSData dataWithContentsOfURL:[NSURL URLWithString:website4]]; 
    NSString *strResult4 = [[[NSString alloc] initWithData:dataURL4 encoding:NSUTF8StringEncoding]autorelease]; 
    NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:strResult4]]; 
    UIImage* image = [[UIImage alloc] initWithContentsOfFile:@"%@PlaceholderApp.png"]; 
    [cell.imageView setImage:image];*/ 
    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; 
    return cell; 
} 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

    //Get the selected country 
    NSString *selectedCountry = [name objectAtIndex:indexPath.row]; 

    //Initialize the detail view controller and display it. 
    DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]]; 
    dvController.selectedCountry = selectedCountry; 
    [self.navigationController pushViewController:dvController animated:YES]; 
    [dvController release]; 
    dvController = nil; 
     } 

      - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView    accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { 

     //return UITableViewCellAccessoryDetailDisclosureButton; 
     return UITableViewCellAccessoryDisclosureIndicator; 
       } 

      - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath: (NSIndexPath *)indexPath { 

      [self tableView:tableView didSelectRowAtIndexPath:indexPath]; 
        } 

什麼問題?

回答

2

這意味着它說什麼。您正在使用已棄用的方法。刪除你的這個方法的實現:

-(UITableViewCellAccessoryType)tableView:(UITableView *)tableView             accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath 

坐落在的cellForRowAtIndexPath附件類型,而不是:

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

我現在你已經在做見。