如何在ios中通过引用传递布尔调用

时间:2013-11-14 18:57:38

标签: ios

我想通过引用传递一个布尔值NegatiefOfNiet调用。我怎么能这样做?

- (NSMutableArray *)ontbindInFactoren:(int)product inTabel:(NSMutableArray *)tabel voorAlDanNietNegatief: (BOOL) NegatiefOfNiet

我意识到我应该做这样的程序:

  - (bool)ontbindInFactoren:(int)product inTabel:(NSMutableArray *)tabel voorAlDanNietNegatief: (BOOL) NegatiefOfNiet

因为tabel有一个指针所以我不应该返回tabel。问题是所有代码都是现在写的,所以我想通过引用传递布尔调用。这是怎么做到的?

的Tx

1 个答案:

答案 0 :(得分:0)

请尝试以下代码:

BOOL NegatiefOfNiet = NO;
[self ontbindInFactoren:product inTable:tabel voorAlDanNietNegatief:&NegatiefOfNiet];

- (NSMutableArray *)ontbindInFactoren:(int)product inTabel:(NSMutableArray *)tabel voorAlDanNietNegatief:(BOOL *)NegatiefOfNiet
{
    *NegatiefOfNiet = YES;
}