在UIButton上放置详细信息披露按钮

时间:2013-09-10 09:08:11

标签: ios ios6 uibutton uikit

如何在UIButton的文本右侧添加详细信息公开按钮,也许使用边缘插入?

1 个答案:

答案 0 :(得分:1)

您可以创建UIButton类型UIButtonTypeDetailDisclosure,并将其添加为按钮的子视图。

像:

UIButton *mainButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[mainButton setTitle:@"Click" forState:UIControlStateNormal];
[mainButton setFrame:CGRectMake(10, 10, 100, 50)];
[self.view addSubview:mainButton];

//Detail Disclosure button
UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[detailButton setFrame:CGRectMake(70, 10, 30, 30)];
[mainButton addSubview:detailButton];