在xcode编译的时候,提示了code will never be executed这个警告。百度了一下,大体的意思是,该代码永远不会执行的意思。
比如:
- (void)setMyStyle:(AddressBookStyle)myStyle { _myStyle = myStyle; return; //>>>>>珠珠<<<<<<因为有return 走不到 if里面,所以注视了--0726 if (myStyle == AddressBookStyleNoneFriend) { _topView.hidden = NO; _midView.hidden = NO; _defaultView.hidden = YES; _myHeightNum.constant = 113; _becameCodeBtn.hidden = YES; [_addSomeOneBtn setTitle:@"邀请好友加入" forState:UIControlStateNormal]; _btnTopLabe.text = @"您的通讯录没有成员可加入项目"; self.frame = CGRectMake(0, 0, kScreenWidth, 180); }else if(myStyle == AddressBookStyleHaveFriend) { _topView.hidden = NO; _midView.hidden = NO; _defaultView.hidden = YES; _myHeightNum.constant = 153; _becameCodeBtn.hidden = NO; [_addSomeOneBtn setTitle:@"从通讯录中导入" forState:UIControlStateNormal]; _btnTopLabe.text = @"请导入讨论组成员"; self.frame = CGRectMake(0, 0, kScreenWidth, 220); }else if (myStyle == AddressBookStyleDefault) { _topView.hidden = YES; _midView.hidden = YES; _defaultView.hidden = NO; self.frame = CGRectMake(0, 0, kScreenWidth, 95); } }
因为有return,所以,if里面的永远都走不到。