我有以下代码,其中包含bool if语句,在另一种方法中,我更改了bool的值,我知道我需要回忆一下方法[self someMethod];
,但我只是想反映if中的变化声明并没有再回想起其他一切,我该怎么做?感谢
-(void)someMethod
{
//start my code here
if (boolvalueisTrue)
{
//change this part only
}
}
-(void)changeBool {
boolvalueisTrue = TRUE;
[self someMethod];
//instead of calling the whole method i just want to reflect
//the changes inside my if statement
}
答案 0 :(得分:1)
将if语句中的代码分解为一个单独的方法,这两个方法都会调用。