将 UISlider 连接到 fontSize [ (IBAction)font1 和 (IBAction)font2 ] 的可能方式。这是代码
。H
@interface ViewController : UIViewController
{
IBOutlet UISlider* fontSizeSlider;
IBOutlet UITextView* textView;
}
-(IBAction)sliderValueChanged:(UISlider*)sender;
-(IBAction)font1;
-(IBAction)font2;
@end
.m
-(IBAction)sliderValueChanged:(UISlider*)sender
{
textView.font = [UIFont fontWithName:@"??????" size:sender.value];
}
-(IBAction)font1{
textView.font = [UIFont fontWithName:@"Heiti TC" size:18];
}
-(IBAction)font2{
textView.font = [UIFont fontWithName:@"Marker Felt" size:18];
}
-(IBAction)font1; //[UIButton]
-(IBAction)font1; //[UIButton]
-(IBAction)sliderValueChanged; //[UISlider]