-(void)listButton{ // #define OPTION_BUT_HEIGHT 50 // #define OPTION_BUT_WIDTH 180 // CGSize _screenSize; // _screenSize = [UIScreen mainScreen].bounds.size; NSInteger numButton = 2; NSInteger butIndex0 = 0; NSInteger butIndex1 = 1; UIButton* backButton = [UIButton buttonWithType:UIButtonTypeSystem]; CGRect frame = CGRectMake((_screenSize.width - OPTION_BUT_WIDTH)/2, butIndex0*(_screenSize.height - (numButton*OPTION_BUT_HEIGHT))/(numButton+1) + 3*OPTION_BUT_HEIGHT, OPTION_BUT_WIDTH, OPTION_BUT_HEIGHT); backButton.frame = frame; [backButton addTarget:self action:@selector(but0Click:) forControlEvents:UIControlEventTouchUpInside]; [backButton setTitle:@"Button 0" forState:(UIControlState) UIControlStateNormal]; [backButton.titleLabel setFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:18]]; [backButton setBackgroundColor:[UIColor brownColor]]; [backButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [self.view addSubview:backButton]; UIButton* resumeButton = [UIButton buttonWithType:UIButtonTypeSystem]; CGRect resumeFrame = CGRectMake((_screenSize.width - OPTION_BUT_WIDTH)/2, butIndex1*(_screenSize.height - (numButton*OPTION_BUT_HEIGHT))/(numButton+1) + 3*OPTION_BUT_HEIGHT, OPTION_BUT_WIDTH, OPTION_BUT_HEIGHT); resumeButton.frame = resumeFrame; [resumeButton addTarget:self action:@selector(but1Click:) forControlEvents:UIControlEventTouchUpInside]; [resumeButton setTitle:@"Button 1" forState:(UIControlState) UIControlStateNormal]; [resumeButton.titleLabel setFont:[UIFont fontWithName:@"MarkerFelt-Thin" size:18]]; [resumeButton setBackgroundColor:[UIColor greenColor]]; [resumeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [self.view addSubview:resumeButton]; }