zoukankan      html  css  js  c++  java
  • iOS 按钮文字加划掉线

    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(20, 50, 120, 40)];
        
        NSDictionary *normalTitleAttributes = @{
                                                NSForegroundColorAttributeName: [UIColor blueColor],
                                                NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)
                                                };
        NSAttributedString *normalAttributedTitle = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Button", nil) attributes:normalTitleAttributes];
        [btn setAttributedTitle:normalAttributedTitle forState:UIControlStateNormal];
        
        // Set the button's title for highlighted state.
        NSDictionary *highlightedTitleAttributes = @{
                                                     NSForegroundColorAttributeName : [UIColor blueColor],
                                                     NSStrikethroughStyleAttributeName: @(NSUnderlineStyleThick)
                                                     };
        NSAttributedString *highlightedAttributedTitle = [[NSAttributedString alloc] initWithString:NSLocalizedString(@"Button", nil) attributes:highlightedTitleAttributes];
        [btn setAttributedTitle:highlightedAttributedTitle forState:UIControlStateHighlighted];
        
        [btn addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:btn];
  • 相关阅读:
    17多校6 HDU
    E. Present for Vitalik the Philatelist 反演+容斥
    HDU
    F. Cowmpany Cowmpensation dp+拉格朗日插值
    hdu6088 组合数+反演+拆系数fft
    任意模数fft
    Codeforces Round #258 (Div. 2)E
    bzoj3670: [Noi2014]动物园
    HDU
    IO-InputStreamReader
  • 原文地址:https://www.cnblogs.com/lihaibo-Leao/p/4424998.html
Copyright © 2011-2022 走看看