2012-07-12 74 views
1

我知道这个问题已被问及已回答,但我无法找到解决方案。再次不平衡的呼叫开始/结束外观转换

我有这个错误,即使我不推牵连视图控制器:

不平衡呼叫开始为/终端外形的转变。

这里是我的代码NewsViewController.m

#import "NewsViewController.h" 
#import "XMLToObjectParser.h" 
#import "UneNews.h" 

#define USE_CUSTOM_DRAWING 1 

@interface NewsViewController() 

@end 

@implementation NewsViewController 
@synthesize imageView; 
@synthesize vueDetail; 

@synthesize tableauNews,tableViewFluxRSS; 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil tableauDeNews:(NSMutableArray *)tableauDeNews 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 

     //récupération du tableau de news initialisé 
     tableauNews = tableauDeNews; 
    } 
    return self; 
} 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view from its nib. 
    tableViewFluxRSS.separatorStyle = UITableViewCellSeparatorStyleNone; 
    tableViewFluxRSS.rowHeight = 143; 
    tableViewFluxRSS.backgroundColor = [UIColor clearColor]; 

} 

- (void)viewDidUnload 
{ 
    [self setImageView:nil]; 
    [self setVueDetail:nil]; 
    [super viewDidUnload]; 
    // Release any retained subviews of the main view. 
    // e.g. self.myOutlet = nil; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return NO; 
} 


//Navigation 

- (IBAction)goHome:(id)sender{ 
    [self.navigationController popToRootViewControllerAnimated:YES];  
} 

// Override to support row selection in the table view. 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    // Navigation logic may go here -- for example, create and push another view controller. 
    [vueDetail loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[[tableauNews objectAtIndex:indexPath.row] detail]]]]; 

} 


//gestion du UITableView 

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

// Customize the number of rows in the table view. 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return [tableauNews count]; 
} 

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 


    const NSInteger TOP_LABEL_TAG = 1001; 
    const NSInteger BOTTOM_LABEL_TAG = 1002; 
    const NSInteger DATE_LABEL_TAG = 1003; 
    const NSInteger ANNEE_LABEL_TAG = 1004; 
    UILabel *topLabel; 
    UILabel *bottomLabel; 
    UILabel *dateLabel; 
    UILabel *anneeLabel; 
    UILabel *enSavoirPlus; 

    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableViewFluxRSS dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) 
    { 
     // 
     // Create the cell. 
     // 
     cell = [[UITableViewCell alloc] 
       initWithStyle:UITableViewCellStyleDefault 
             reuseIdentifier:CellIdentifier]; 

     // 
     // Configure the properties for the text that are the same on every row 
     // 
      dateLabel = [[UILabel alloc] 
     initWithFrame: 
     CGRectMake(6,46,75,57)]; 

     dateLabel.tag = DATE_LABEL_TAG; 
     dateLabel.backgroundColor = [UIColor clearColor]; 
     dateLabel.textColor = [UIColor whiteColor]; 
     dateLabel.font = [UIFont systemFontOfSize:28]; 
     [cell.contentView addSubview:dateLabel]; 
     // 
     // Configure the properties for the text that are the same on every row 
     // 
     anneeLabel = [[UILabel alloc] 
        initWithFrame: 
        CGRectMake(6,100,70,57)]; 

     anneeLabel.tag = DATE_LABEL_TAG; 
     anneeLabel.backgroundColor = [UIColor clearColor]; 
     anneeLabel.textColor = [UIColor whiteColor]; 
     anneeLabel.font = [UIFont systemFontOfSize:31]; 
     [cell.contentView addSubview:anneeLabel]; 

     topLabel = 
     [[UILabel alloc] 
     initWithFrame: 
     CGRectMake(94,5,325,20)]; 

     [cell.contentView addSubview:topLabel]; 

     // 
     // Configure the properties for the text that are the same on every row 
     // 
     topLabel.tag = TOP_LABEL_TAG; 
     topLabel.backgroundColor = [UIColor clearColor]; 
     topLabel.textColor = [UIColor whiteColor]; 
     topLabel.font = [UIFont systemFontOfSize:18]; 


     // 
     // Configure the properties for the text that are the same on every row 
     // 
     bottomLabel = 
     [[UILabel alloc] 
     initWithFrame: 
     CGRectMake(94,30,325,80)]; 

     bottomLabel.tag = BOTTOM_LABEL_TAG; 
     bottomLabel.backgroundColor = [UIColor clearColor]; 
     bottomLabel.textColor = [UIColor whiteColor]; 
     bottomLabel.font = [UIFont systemFontOfSize:18]; 
     [bottomLabel setLineBreakMode:UILineBreakModeWordWrap]; 
     [bottomLabel setNumberOfLines:0]; 

     [cell.contentView addSubview:bottomLabel]; 

     // 
     // Create a background image view. 
     // 
     cell.backgroundView = 
     [[UIImageView alloc] init]; 
     cell.selectedBackgroundView = 
     [[UIImageView alloc] init]; 

     enSavoirPlus = 
     [[UILabel alloc] 
     initWithFrame: 
     CGRectMake(260,121,200,20)]; 

     [cell.contentView addSubview:enSavoirPlus]; 

     // 
     // Configure the properties for the text that are the same on every row 
     // 
     enSavoirPlus.tag = TOP_LABEL_TAG; 
     enSavoirPlus.backgroundColor = [UIColor clearColor]; 
     enSavoirPlus.textColor = [UIColor yellowColor]; 
     //topLabel.highlightedTextColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.9 alpha:1.0]; 
     enSavoirPlus.font = [UIFont systemFontOfSize:18]; 
    } 

    else 
    { 
     topLabel = (UILabel *)[cell viewWithTag:TOP_LABEL_TAG]; 
     bottomLabel = (UILabel *)[cell viewWithTag:BOTTOM_LABEL_TAG]; 
     dateLabel = (UILabel *)[cell viewWithTag:DATE_LABEL_TAG]; 
     anneeLabel = (UILabel *)[cell viewWithTag:ANNEE_LABEL_TAG]; 

    } 

    topLabel.text = [[tableauNews objectAtIndex:indexPath.row] titre]; 
    bottomLabel.text = [[tableauNews objectAtIndex:indexPath.row] contenu]; 
    [bottomLabel sizeToFit]; 
    dateLabel.text = [[tableauNews objectAtIndex:indexPath.row] dateDeParution]; 
    anneeLabel.text = [[tableauNews objectAtIndex:indexPath.row] annee]; 
    enSavoirPlus.text = @"En savoir plus..."; 

    // 
    // Set the background and selected background images for the text. 
    // Since we will round the corners at the top and bottom of sections, we 
    // need to conditionally choose the images based on the row index and the 
    // number of rows in the section. 
    // 
    UIImage *rowBackground; 

     rowBackground = [UIImage imageNamed:@"fd-textes-news.png"]; 
     //selectionBackground = [UIImage imageNamed:@"middleRowSelected.png"]; 

    ((UIImageView *)cell.backgroundView).image = rowBackground; 
    //((UIImageView *)cell.selectedBackgroundView).image = selectionBackground; 


    return cell; 
} 


//fin gestion UITableView 


@end 

我想我的问题可能是由于我的执行初始化 的 - (ID)initWithNibName:(的NSString *)nibNameOrNil包(一个NSBundle *)nibBundleOrNil tableauDeNews:(NSMutableArray *)tableauDeNews;

需要帮助 THX

+0

好的我有一个线索,NewsViewController的initWithNibName似乎被其他viewControllers调用,但我继续找到他们的NewsViewController的痕迹 – Abzamon 2012-07-25 09:17:07

回答

0

我发现这个问题:

要创建我的按钮我将它们复制粘贴到InterfaceBuilder中, 复制按钮仍保留着古老的行动,我有一个新的IBAction为。

我复制的按钮有2个IBact(一个调用NewsViewController,另一个调用正确的viewController)。 每次单击复制的按钮时都会弹出消息。

所以,请检查您的按钮在界面生成器,“不平衡通话开始/结束的外观转换”可以有两个IBActions按钮引起的,冲突的(如推两种不同viewControllers在同一时间)。

相关问题