单击下面的按钮操作时,出现异常:
-[UIRoundedRectButton selectedSegmentIndex]:发送到实例 0x8178b90 的无法识别的选择器;
'
(它也被初始化为 - (IBAction)genderBtn:(id)sender; 在头文件中)。
我不知道我是否应该以某种方式将其初始化为另一种方法或不进行全局初始化。任何方法的想法将不胜感激。
- (IBAction)submitButton:(id)sender {
double BAC=0;
// NSString *weight=weightTextField.text;
//Other variables etc.
UISegmentedControl *gender = (UISegmentedControl *)sender;
UIButton *gender = (UIButton *)sender;
if (gender.selected == 0 ) {
} else if (gender.selected = 1){
}
UIAlertView *alertMessage = [[UIAlertView alloc] initWithTitle:@"Your Results:"
message:[NSString stringWithFormat:@" Your Percentage is: "]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertMessage show];
}