更改方法
问题描述:
内的某些值我有下面的代码与bool if语句里面和另一种方法我更改bool的值,我知道我需要回忆的方法[self someMethod];
但我只是想反映在如果声明并没有再次回想一切,我该怎么做?谢谢更改方法
-(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
}
答
将if语句中的代码分解为两个其他方法调用的单独方法。