当前位置:网站首页 > 资讯中心 > IT技术 >
iOS中 UIActionSheet字体如何修改
发布日期:2017-07-05 所属分类:IT技术
;

 一,效果图。

 

iOS中 UIActionSheet字体如何修改 三联

二,代码。

RootViewController.h
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController
<UIActionSheetDelegate>
@end

RootViewController.m

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
  UIActionSheet *actionSheet=[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"手机找回密码", nil];
  [actionSheet showInView:self.view];
}
#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
  switch (buttonIndex) {
    case 0:
    {
      NSLog(@"--0--");
    }
      break;
    case 1:
    {
       NSLog(@"--1--");
    }
      break;
    default:
      break;
  }
}
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet
{
  for (UIView *subViwe in actionSheet.subviews) {
    if ([subViwe isKindOfClass:[UIButton class]]) {
      UIButton *button = (UIButton*)subViwe;
      button.titleLabel.font=[UIFont systemFontOfSize:15];
      [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    }
  }
}

本文章地址http://www.vzeo.com/news/xuetang/800311.html 由   友站网 编辑整理,转载请注明出处
推荐资讯