【发布时间】:2019-05-27 16:10:20
【问题描述】:
每次我使用"self.SegControl.selectedSegmentIndex" 时,我都会在以下code 中获得SIGABRT 信号:
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 的输出。我想让我的程序知道选择了哪个段。 请帮帮我! 谢谢!
【问题讨论】:
标签: objective-c uisegmentedcontrol sigabrt