0

ポップオーバービュー内に2つのボタンを表示したい。WEPOPOVERを使用していますが、1つのbtnを表示できます。

しかし、2つのボタンの表示方法がわかりません。

UIButton *editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[editBtn setTitle:@"EDIT ME" forState:UIControlStateNormal];
[editBtn setFrame:CGRectMake(250, 0, 100,40)];
[editBtn addTarget:self action:@selector() forControlEvents:UIControlEventTouchUpInside];
[editBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
editBtn.titleLabel.shadowOffset = CGSizeMake(0, -1);
editBtn.titleLabel.font = [UIFont boldSystemFontOfSize:20];
editBtn.backgroundColor = [UIColor blackColor];

UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[deleteBtn setTitle:@"Delete ME" forState:UIControlStateNormal];
[deleteBtn setFrame:CGRectMake(250, 0, 100,40)];
[deleteBtn addTarget:self action:@selector(doSubscription) forControlEvents:UIControlEventTouchUpInside];
[deleteBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
deleteBtn.titleLabel.shadowOffset = CGSizeMake(0, -1);
deleteBtn.titleLabel.font = [UIFont boldSystemFontOfSize:20];
deleteBtn.backgroundColor = [UIColor blackColor];


//  place inside a temporary view controller and add to popover
UIViewController *viewCon = [[UIViewController alloc] init];
viewCon.view = (UIView *)[NSArray arrayWithObjects:editBtn,deleteBtn, nil];
viewCon.contentSizeForViewInPopover = editBtn.frame.size;       // Set the content size

navPopover = [[WEPopoverController alloc] initWithContentViewController:viewCon];
[navPopover presentPopoverFromRect:editButton.frame
                                inView:self.view
              permittedArrowDirections:UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown
                              animated:YES];    
4

1 に答える 1

0

両方のボタンに同じフレームを指定しました。つまり、ボタンは1つだけです。

[editBtn setFrame:CGRectMake(250, 0, 100,40)];

[deleteBtn setFrame:CGRectMake(250, 0, 100,40)];
于 2012-09-05T10:21:04.587 に答える