2013-03-27 47 views
0

我有這個問題,當我的代碼執行,然後我點擊表上的項目,它需要我詳細查看。事情正常顯示,但在控制檯有這樣的信息:不平衡轉換ios

2013年3月27日13:09:30.616 LinkTest [3605:C07]至 不平衡呼叫開始/結束的外觀轉變爲 。

我知道這是經常在這裏報道並查看答案,但似乎沒有任何工作。也許我錯了。這裏是tableviewcontroller的代碼:

#import "EventListingTableViewController.h" 
#import "EventListingDetailViewController.h" 

@interface EventListingTableViewController() 

@end 

@implementation EventListingTableViewController 

- (id)initWithStyle:(UITableViewStyle)style 
{ 
    self = [super initWithStyle:style]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 


-(void)fetchEventDetails 
{  
    NSData *jsonData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://xsysdevelopment.com/ios/read.php"]]; 
    NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:nil]; 
    self.eventsTitles = [[NSMutableArray alloc] init]; 
    self.eventsCity = [[NSMutableArray alloc] init]; 

    for(id object in dict){ 
     [self.eventsTitles addObject:object[@"title"]]; 
     [self.eventsCity addObject:object[@"city"]]; 
    } 

} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    [self fetchEventDetails]; 
    // Uncomment the following line to preserve selection between presentations. 
    //self.clearsSelectionOnViewWillAppear = NO; 

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 
    // self.navigationItem.rightBarButtonItem = self.editButtonItem; 


} 


- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    // Return the number of sections. 
    return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    // Return the number of rows in the section. 
    return self.eventsTitles.count; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    int row = [indexPath row]; 

    cell.textLabel.text = self.eventsTitles[row]; 
    cell.detailTextLabel.text = self.eventsCity[row]; 

    return cell; 
} 




#pragma mark - Table view delegate 

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

    // Navigation logic may go here. Create and push another view controller. 

    EventListingDetailViewController *detailViewController = [[EventListingDetailViewController alloc] initWithNibName:@"EventListingDetailViewController" bundle:nil]; 
    // ... 
    // Pass the selected object to the new view controller. 
    [self.navigationController pushViewController:detailViewController animated:YES]; 

} 

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([[segue identifier] isEqualToString:@"eventDetailSeague"]) 
    { 

     NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 
     EventListingDetailViewController *detailViewController = [segue destinationViewController]; 

     int row = [indexPath row]; 

     detailViewController.eventDetails = @[self.eventsTitles[row], self.eventsCity[row]]; 



    } 
} 

如果有人告訴我我要去哪裏出錯,我將非常感激。我是iOS新手,所以只有有用的批評纔會有用。

問候

回答

1

如果您是通過故事板爲UITableView使用塞格斯則不需要didSelectRowAtIndexPath:代碼。由於這個原因,我相信你會發射兩次。