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];