-2

我想在 bbc 新闻应用程序等视图控制器的标题中放置一个图标,以最大化和最小化字体。

在此处输入图像描述

我必须知道,有没有图书馆可以做到这一点?

4

3 回答 3

1

希望这会帮助你..

UIView *customView=[[UIView alloc]initWithFrame:CGRectMake(10, 0, 40, 40)];

 UIButton *btnAction =[UIButton buttonWithType:UIButtonTypeCustom];
 [btnAction addTarget:self action:@selector(btnActionClick) forControlEvents:UIControlEventTouchDragInside];
 [btnAction setFrame:CGRectMake(0, 0, 40, 58)];
[customView addSubview:btnAction];

 UIButton *btnFont =[UIButton buttonWithType:UIButtonTypeCustom];
 [btnFont addTarget:self action:@selector(btnFontClick) forControlEvents:UIControlEventTouchDragInside];
 [btnAction setFrame:CGRectMake(30, 0, 40, 58)];
 [customView addSubview:btnAction]

 UIBarButtonItem *MessageBtn=[[UIBarButtonItem alloc]initWithCustomView:customView];
于 2013-06-27T11:09:59.040 回答
0

您可以使用

[self.navigationItem setRightBarButtonItem:"your button"animated:YES];
于 2013-06-27T10:50:06.160 回答
0

通过使用以下代码,您可以根据需要将按钮放在视图控制器的标题中。

但是要设置字体(最小化或最大化),您必须编写其他代码。

你可以为它做谷歌。

[self.navigationItem setRightBarButtonItem:"BUTTON"animated:YES];
于 2013-06-27T11:41:01.777 回答