0

我的项目中有以下代码。

我收到如下所述的警告: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;
    }  

如何摆脱这些警告?

4

0 回答 0