• 【代码笔记】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];
                
            }
        }
    }
    复制代码
  • 相关阅读:
    Web Api 模型绑定 二
    C#关键字
    ASP.NET Core MVC 过滤器
    EF性能优化篇一
    Linq
    HTTP协议
    Linux进程管理(11)
    Linux网络配置(10)
    Django模板修炼
    递归
  • 原文地址:https://www.cnblogs.com/yang-guang-girl/p/7047280.html
Copyright © 2020-2023  润新知