每次我使用"self.SegControl.selectedSegmentIndex"
时,都会在以下SIGABRT
中收到code
信号:
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));// signal SIGABRT
}
}
我试图找到self.SegControl.selectedSegmentIndex
的值:
long a=self.SegControl.selectedSegmentIndex;
但是,我发现我什至不能使用self.SegControl.selectedSegmentIndex
。
...
@property (weak, nonatomic) IBOutlet UISegmentedControl *SegControl;
...
- (IBAction)Button:(id)sender {
NSMutableString *str=[NSMutableString new];
if(self.SegControl.selectedSegmentIndex==0){
[str appendString:@"unit 2"];
}
else if(self.SegControl.selectedSegmentIndex==1){
[str appendString:@"unit 3"];
}
else if(self.SegControl.selectedSegmentIndex==2){
[str appendString:@"unit 4"];
}
self.Output.text=str;
}
...
我想获取self.SegControl.selectedSegmentIndex的输出。我想让我的程序知道选择了哪个段。 请帮帮我! 谢谢!