【发布时间】:2015-01-21 10:07:34
【问题描述】:
我的视图中有 3 个按钮,一个按钮可以更改文本视图中单词的背景颜色,一个可以正常工作。一个按钮可以更改文本视图中的单词轮廓。每次单击时都会出现这个错误。
这是我的错误:
libc++abi.dylib: terminating with uncaught exception of type NSException
and Thread 1 : signal SIGABRT
而且系统不知道究竟是哪个部分崩溃,所以我查看了日志导航器。这是我的日志导航器日志:
2015-01-21 17:42:04.482 Attributer[2592:79541] -[ViewController outlineBodySelection]: unrecognized selector sent to instance 0x7f803a59cc50
2015-01-21 17:42:04.485 Attributer[2592:79541] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController outlineBodySelection]: unrecognized selector sent to instance 0x7f803a59cc50'
这是我的代码:
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *headline;
@property (weak, nonatomic) IBOutlet UITextView *body;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)changeBodySelectionColourToMatchBackgroundOfButton:(UIButton *)sender {
[self.body.textStorage addAttribute:NSForegroundColorAttributeName
value:sender.backgroundColor
range:self.body.selectedRange];
}
- (IBAction)outlineBodySelection
{
[self.body.textStorage addAttributes:@{ NSStrokeWidthAttributeName : @-3,
NSStrokeColorAttributeName : [UIColor blackColor] }range:self.body.selectedRange];
}
- (IBAction)unoutlineBodySelection
{
[self.body.textStorage removeAttribute:NSStrokeWidthAttributeName range:self.body.selectedRange];
}
@end
我想最后两个类出现错误,但是哪里出错了,我该如何解决? 请有人帮助我。
【问题讨论】:
-
能否显示一键换字的代码
-
连接到ibaction的outlineBodySelection检查
-
启用
exception brakepoint并尝试让您的应用崩溃。
标签: ios objective-c iphone ios7 ios8