Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edit (I re-read the question and you might want what the other answer from Stew suggested):</strong></p> <pre><code>BOOL myBool = [@"1" boolValue]; myBool = [someObject boolValue]; </code></pre> <p>These are some of the conversion methods for NSString - Also see the <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html" rel="nofollow">NSString Reference Here</a>:</p> <pre><code>- (double)doubleValue; - (float)floatValue; - (int)intValue; - (NSInteger)integerValue; - (long long)longLongValue; // (boolValue) Skips initial space characters (whitespaceSet), // or optional -/+ sign followed by zeroes. // Returns YES on encountering one of "Y", "y", "T", "t", or a digit 1-9. // It ignores any trailing characters. - (BOOL)boolValue; </code></pre> <p><br/></p> <p>Also, from <a href="http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/nsnumber_Class/Reference/Reference.html#//apple_ref/occ/instm/NSNumber/boolValue" rel="nofollow">NSNumber Class Reference</a>:</p> <blockquote> <p>boolValue Returns the receiver’s value as a BOOL.</p> <p><code>- (BOOL)boolValue</code></p> <p>Return Value The receiver’s value as a BOOL, converting it as necessary.</p> <p>Special Considerations Prior to Mac OS X v10.3, the value returned isn’t guaranteed to be one of YES or NO. A 0 value always means NO or false, but any nonzero value should be interpreted as YES or true.</p> </blockquote> <hr> <p><strike> Try this:</p> <pre><code>[NSNumber numberWithBool:YES] [NSNumber numberWithBool:NO] [NSNumber numberWithInt:1] [NSNumber numberWithFloat:0.25] // etc... - (IBAction)Calcluate:(id)sender { BOOL something; something = [hi [NSNumber numberWithBool:BOOL]]; } </code></pre> <p><a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsnumber_Class/Reference/Reference.html" rel="nofollow">NSNumber reference</a></p> <p>Since things like <code>BOOL</code>, <code>NSInteger</code>, <code>NSUInteger</code>, etc are not pointers, they cannot do certain things like be values for a dictionary, etc. For this purpose, NSNumber was created. It wraps these types in a class so they can be used as arguments for passing to <code>selectors</code>, or stored in <code>NSDictionary</code>'s.</p> <p>Here is a common thing I do:</p> <pre><code>[self.myLoadingView performSelectorOnMainThread:@selector(setHidden:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:YES]; </code></pre> <p></strike></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.
    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