2012-07-12 76 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在同一時間)。

相關問題