LoginSignup
7
7

More than 5 years have passed since last update.

NSIntegerのpropertyに値が代入されているかどうかの判定

Posted at

初期化する際に、NSNotFoundを代入する
NSNotFoundかどうかで値が代入されたかどうか判定する


@interface Paginator

@property (nonatomic, assgin) NSUInteger currentPage;

@end

@implementation 

- (id)init
{
    self = [super init];
    if (self) {
        self.currentPage = NSNotFound;
    }
}

- (BOOL)hasCurrentPage
{
    return _currentPage != NSNotFound;
}

@end

参考

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7