1,自定义Button
UIButton *subjectButton = [UIButtonbuttonWithType:UIButtonTypeCustom];//此处可以修改button类型
[subjectButtonsetFrame:CGRectMake(109,604, 132, 44)];
[subjectButton setTitle:@""forState:UIControlStateNormal];
[meetingaddSubview:subjectButton];
[subjectButton addTarget:selfaction:@selector(enterSubject:)forControlEvents:UIControlEventTouchUpInside];
- (void)enterSubject:(id)sender
{
NSLog(@"进入会议详情页");
}
//摘录网上资源
//定义按钮标题
[sampleButton setTitle:@"Button Title" forState:UIControlStateNormal];
//定义按钮标题字体格式
[sampleButton.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
//定义按钮背景图片,redButton.png已经存在,拖放添加图片文件到image项目文件夹中
[sampleButton setBackgroundImage:[[UIImage imageNamed:@"redButton.png"]stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0] forState:UIControlStateNormal];