0

Core Graphics を使い始めたばかりで、何が起こっているのかまったくわかりませんでした。

次のコードでは、 UINavigationControllerの上に重ねられた小さな丸みを帯びた半透明の黒い正方形を作成しようとしていますが、これまでのところ何も表示されていません...

UIView *notificationView = [[UIView alloc] initWithFrame:[[[self navigationController] view] frame]];

CGRect rect = CGRectMake(self.view.frame.size.width / 2 - 50, self.view.frame.size.height / 2, 100, 100);
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0);
[[UIColor colorWithWhite:0 alpha:0.5] setFill];

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:10];
[path fill];

[notificationView setNeedsDisplay];

[[[self navigationController] view] addSubview:notificationView];
4

1 に答える 1