Note that there are some explanatory texts on larger screens.

plurals
  1. POModal uiviewcontroller with xib won't show hidden controls
    primarykey
    data
    text
    <p>I have a simple UIViewcontroller with an xib. I present this modally and it displays correctly I have three controls on the xib that I wish to hide until the user presses the OK button and then display when app is connecting to remote server and then hiding themselves when it is finished. I have hooked them up to the IBOutlets correctly. My problem is that when the IBAction method that the OK button is hooked up to is called, setting their hidden property to NO doesn't make them visible. Here is the code:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "PasswordWebViewController.h" @interface ExistingUserController : UIViewController&lt;UITextFieldDelegate&gt; { UITextField *emailField; UITextField *passwordField; NSString *password; NSString *email; UIActivityIndicatorView *spinner; UIImageView *loadingImg; UILabel *loadingLabel; } @property (nonatomic, retain) IBOutlet UITextField *emailField; @property (nonatomic, retain) IBOutlet UITextField *passwordField; @property (nonatomic, retain) NSString *email; @property (nonatomic, retain) NSString *password; @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *spinner; @property (nonatomic, retain) IBOutlet UILabel *loadingLabel; @property (nonatomic, retain) IBOutlet UIImageView *loadingImg; -(IBAction) onClickSend: (id) sender; -(IBAction) onClickCancel: (id) sender; -(IBAction) onClickResetPW: (id) sender; -(void)showLoadingIndicators; -(void)hideLoadingIndicators; @end </code></pre> <p>On the view did load I call the hideLoadingIndicators to set the hidden to property to YES</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [self hideLoadingIndicators]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopSpinner:) name:@"StopSpinnerOnExistingUserController" object:nil]; // Do any additional setup after loading the view from its nib. } -(void)hideLoadingIndicators{ loadingLabel.hidden = YES; loadingImg.hidden = YES; [spinner stopAnimating]; } </code></pre> <p>This works fine but when I call the showLoadingIndicators in the onClickSend method where it sets hidden to NO then the controls don't show. It definitely call this method.</p> <pre><code> -(IBAction) onClickSend: (id) sender{ if ([email length] &gt;0 &amp;&amp; [password length] &gt;0){ UIApplication *myApp = [UIApplication sharedApplication]; [self showLoadingIndicators]; noIBAppDelegate*appDelegate = (noIBAppDelegate*)myApp.delegate; [appDelegate tryLoadingUserEmail:email AndPassword:password]; } else{ UIAlertView *missingAlert = [[[UIAlertView alloc] initWithTitle:@"Error" message:@"You have a blank email or password." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease]; [missingAlert show]; } } -(void)showLoadingIndicators{ self.loadingImg.hidden =NO; [self.view bringSubviewToFront:loadingImg]; self.loadingLabel.hidden = NO; [self.view bringSubviewToFront:loadingLabel]; [self.spinner startAnimating]; } </code></pre> <p>I'm probably missing something obvious here!!!</p>
    singulars
    1. This table or related slice is empty.
    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