iOS中 UIActionSheet字体的修改

时间:2022-11-19 19:52:18

一,效果图。

iOS中 UIActionSheet字体的修改

二,代码。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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];
    }
  }
}

以上所述是小编给大家介绍的ios中 uiactionsheet字体的修改,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://www.cnblogs.com/yang-guang-girl/archive/2017/06/19/7047280.html