Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't set a label in a view
    primarykey
    data
    text
    <p>I have the following situation. I have a view controller (ContentController) with 3 buttons at the top. Below I added a second view (contentView), this view should display content that are behind those 3 buttons. So every time I press a button, the contentView changes. So what I did was created three addition controllers. </p> <p>FirstController.m, FirstController.h, FirstController.xib</p> <p>SecondController.m, SecondController.h, SecondController.xib,</p> <p>ThirdController.m, ThirdController.h, ThirdController.xib,</p> <p>in my ContentController.m I added 3 IBActions that handles the change.</p> <pre><code>@interface ViewController () @property (nonatomic,strong) UIViewController *nextController; @end @implementation ViewController @synthesize nextController = _nextController; -(IBAction)chooseFirstController:(id)sender { _nextController = [[FirstController alloc] initWithNibName:@"FirstController" bundle:nil]; [self.contentView addSubview:_nextController.view]; } -(IBAction)chooseSecondController:(id)sender{ _nextController = [[SecondController alloc] initWithNibName:@"SecondController" bundle:nil]; [self.contentView addSubview:_nextController.view]; } -(IBAction)chooseThirdController:(id)sender{ _nextController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil]; [self.contentView addSubview:_nextController.view]; } </code></pre> <p>My first and ThirdController just showing tableviews inside the contentView of contentController. But in my secondController I used a gridView for displaying items. Now when I press a cell, it should go to a detailViewController, whichs shows more information about that cell. So in my cellForRowAtIndex I did the following.</p> <pre><code>- (void)gridView:(NRGridView *)gridView didSelectCellAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"cell clicked"); PlayerDetailController *playerController = [[PlayerDetailController alloc]initWithNibName:@"PlayerDetailController" bundle:nil]; [playerController setLblTest:@"hooray this works"]; [self.view addSubview:playerController.view]; } </code></pre> <p>It correctly executes setLblTest and also showing the detailViewcontroller inside my ContentView. But it don't changes the label. to my @"hooray" this works. But although as you can see in my log it passes it correctly.</p> <pre><code>@synthesize testLabel = _testLabel; @synthesize lblTest = _lblTest; -(void)setLblTest:(NSString *)lblTest{ if(![_lblTest isEqual:lblTest]){ _lblTest = lblTest; } NSLog(@"log komt %@",lblTest); [_testLabel setText:lblTest]; } </code></pre> <p><strong>LOG</strong></p> <pre><code>RacingGenk[567:c07] log komt hooray this works </code></pre> <p>Hope this clarifies more my problem</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload