我正在尝试在我的 ViewController 上为 i-phone 应用程序初始化一个 barbutton 项。
在实施中:
-(void)viewDidLoad
{
UIButton *TakePhoto = [UIButton buttonWithType:UIButtonTypeCustom];
[TakePhoto setTitle:@"Take Photo" forState:UIControlStateNormal];
TakePhoto.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.0f];
[TakePhoto.layer setCornerRadius:4.0f];
[TakePhoto.layer setBorderWidth:1.0f];
[TakePhoto.layer setBorderColor: [[UIColor redColor] CGColor]];
TakePhoto.frame=CGRectMake(200, 100.0, 60.0, 30.0);
[TakePhoto addTarget:self action:@selector(takePicture) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem* barbutton= [[UIBarButtonItem alloc] initWithCustomView:TakePhoto];
}