1 Reply Latest reply: Feb 4, 2013 5:20 AM by just.do.it
jeromefromlyon Level 1 Level 1 (0 points)

Hello,

I have a problem on my application,

I have 2 UIViewController wich contains UITableView. On the first UIViewController, i initialize and call the second view like this :

 

-(BOOL)showUnderView {

   

    if (isUnderVisible) {

       

        [UIView animateWithDuration:0.5 animations:^{

            [self.view setFrame:CGRectMake(15, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height)];

        }];      

                      

               

        [self.view  setUserInteractionEnabled:YES];

        [underC closeKeyboard];

        isUnderVisible = NO;

    } else {

             

        // HERE IS MY SECOND ViewConroller

        underC      = [[CriteriaSubController alloc]    initWithDelegate:delegateCriteriaChange andFrame:CGRectMake(15, 0, self.view.frame.size.width, self.view.frame.size.height)];

        [underView  setFrame:CGRectMake(15, 0, self.view.frame.size.width, self.view.frame.size.height)];

        underView.backgroundColor   = [UIColor colorWithRed:10 green:10 blue:10 alpha:10];

        [underView  addSubview:underC.view];       

       

       // END MODIF

 

       

        [underC updateLocationSearch];

        [underC viewWillAppear:YES];

       

      

       

        [UIView animateWithDuration:0.5 animations:^{

            [self.view setFrame:CGRectMake(offset_x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height)];

        }];     

      

    

        isUnderVisible = YES;

    }

  

    return isUnderVisible;

}

 

But i doesn't work i don't see anything ! Here is my second viewcontroller :

 

 

 

#import "CriteriaSubController.h"

#import <QuartzCore/QuartzCore.h>

 

#import "CoreAppDelegate.h"

#import "SettingsService.h"

#import "LocalizedString.h"

 

 

@implementation CriteriaSubController

 

@synthesize category;

 

 

-(id) initWithDelegate:(id<CriteriaChangeDelegate>) delegate andFrame:(CGRect)frame{

    if ((self = [super init])){

        self.view.frame         = frame;

        delegateCriteriaChange  = delegate;

        NSLog(@"SUB Delegate %@", delegateCriteriaChange);       

    }

   

    return self;   

}

 

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{

    return self;

}

 

-(void) viewDidLoad{   

   

    NSArray * array = [[NSArray alloc] initWithObjects:@"LA", @"AL", @"Typfzzfee", @"zefz", @"Czefze"nil];

    self.category   = array;

    [array  release];

    [super viewDidLoad];

   

    table_enfant               = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 290, 450) style:UITableViewStylePlain];

    table_enfant.delegate      = self;

    table_enfant.dataSource    = self;

         

    [self.view addSubview:table_enfant];

   

    NSLog(@"SUB viewDidLoad");

}

 

 

-(void)viewWillAppear:(BOOL)animated {

    NSLog(@"SUB viewWillAppear");

   

   

    [table_enfant   reloadData];

    [super viewWillAppear:YES];

}

 

-(void) viewDidAppear:(BOOL)animated{

    [super  viewDidAppear:animated];

    [table_enfant   reloadData];

}

 

-(void) viewWillDisappear:(BOOL)animated{

    [super viewWillDisappear:animated];

}

 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

   

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

    }

   

    NSUInteger  row     = [indexPath row];

    cell.textLabel.text = [category objectAtIndex:row];

    if(row == 0){

        cell.selectionStyle = UITableViewCellSelectionStyleNone;

    }

    else{

        cell.accessoryType  = UITableViewCellAccessoryDisclosureIndicator;

    }

    NSLog(@"SUB cellForRow %@", cell.textLabel.text);

    return cell;

}

 

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    NSLog(@"SUB count %d", [self.category count]);

    return [self.category count];

}

 

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

    return nil;

}

 

-(void) validate{

   

}

 

-(void)updateLocationSearch {

   

}

 

-(void) closeKeyboard{

   

}

 

@end

 

Thank you for all your help ! Regards