Note that there are some explanatory texts on larger screens.

plurals
  1. POios objective C Bool not setting
    primarykey
    data
    text
    <p>im creating a custom UITextField, but is not setting a BOOL??</p> <p>MyCustomTextField.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface OMTextField : UIControl &lt;UITextFieldDelegate&gt; { UITextField *_theTextField; BOOL _hasBackGroundImage; } @property (nonatomic, retain)UITextField *theTextField; @property (nonatomic) BOOL hasBackGroundImage; @end </code></pre> <p>MyCustomTextField.m</p> <pre><code>#import "OMTextField.h" @implementation OMTextField @synthesize theTextField = _theTextField; @synthesize hasBackGroundImage = _hasBackGroundImage; - (void)dealloc { [_theTextField release]; [super dealloc]; } - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code self.theTextField = [[[UITextField alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)]autorelease]; //self.theTextField.borderStyle = UITextBorderStyleLine; self.theTextField.text = @"textField"; self.theTextField.delegate = self; if (self.hasBackGroundImage) { NSLog(@"lo tienes"); } if (!self.hasBackGroundImage) { NSLog(@"nana tienes"); } [self addSubview:self.theTextField]; } return self; } /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ @end </code></pre> <p>and the call in my MainVC:</p> <pre><code>MyCustomTextField *textField = [[[MyCustomTextField alloc]initWithFrame:CGRectMake(400, 160, 150, 40)]autorelease]; textField.hasBackGroundImage = YES; textField.backgroundColor = [UIColor grayColor]; textField.theTextField.borderStyle = UITextBorderStyleLine; [self.view addSubview:textField]; </code></pre> <p>so it shows fine, but as you see im setting <code>textField.hasBackGroundImage = YES;</code> </p> <p>but when executed, i see the message for BOOL = NO??</p> <pre><code>nana tienes </code></pre> <p>So what Im I missing?, why is this not evaluated as YES??</p> <p>thanks!</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