Mac開発-カスタムNSButton背景色丸みを帯びた影



Mac Development Custom Nsbutton Background Color Rounded Shadow

記事のディレクトリ

- (void)showStartBtn { if (!self.startButton) { CGSize loadsize = CGSizeMake(180, 60) self.startButton = [[CustomButton alloc] initWithFrame:CGRectMake((self.view.bounds.size.width - loadsize.width)/2, (self.view.bounds.size.height - loadsize.height)/2, loadsize.width, loadsize.height)] self.startButton.shadowOffset = CGSizeMake(1, 2) [self.startButton setTitle:@'Classes begin' color:[NSColor whiteColor] font:18] self.startButton.target = self self.startButton.action = @selector(beginToLive) } [self.view addSubview:self.startButton] }

効果は次のとおりです。
画像

It’s all simple, just for convenience, check-in record