我已经在我的应用程序中编写了这段代码:
- (IBAction)ZoomInFunction{
@try{
UITextField *test = (UITextField *)[self.view viewWithTag:indexNews];
NSLog(@"INDEX NEWS : %d", indexNews);
UIFont *font = test.font;
if(test.font == [font fontWithSize:22])
test.font = [font fontWithSize:22];
else
test.font = [font fontWithSize:font.pointSize+2];
}@catch (NSException *err) {
NSLog(@"Error handler : %@", err);
}
}
- (IBAction)ZoomOutFunction{
@try {
UITextField *test = (UITextField *)[self.view viewWithTag:indexNews];
UIFont *font = test.font;
if(test.font == [font fontWithSize:14])
test.font = [font fontWithSize:14];
else
test.font = [font fontWithSize:font.pointSize-2];
}@catch (NSException *err) {
NSLog(@"Error handler : %@", err);
}
有时代码运行良好,但有时它会显示这样的错误。
错误处理程序:-[UIView 字体]:无法识别的选择器发送到实例 0xac70780