Bool和Int的初始化

时间:2013-06-18 04:27:07

标签: objective-c

我的项目中有以下代码。

我收到警告,如下所述: 1.'假设selectedView是> = 0' 2.假设mode_ChangeEvent为0

BOOL modeChangeEvent = NO;
BOOL invokedByUser = NO;
int currentZoomedView = -1;
int prevButIdx = -1;

-(IBAction)zoomSelectedView:(id)sender
{
    UISegmentedControl *viewSelector = (UISegmentedControl*)sender; 

    int selectedView =  viewSelector.selectedSegmentIndex;    

    if (selectedView>=0) {  //Warning 'Assuming selectedView is >=0 '

        invoked_ByUser = NO;

    }
else return;


    if (mode_ChangeEvent) { //Warning 'Assuming mode_ChangeEvent is 0 '

        invoked_ByUser = NO;    

        mode_ChangeEvent = NO;

        selectedView = current_ZoomedView;  

        prev_ButIdx = -1;
    }  

如何摆脱这些警告?

0 个答案:

没有答案