これはおそらくiOSのレイヤーに関する初心者の質問ですが、それを処理する適切な方法がわかりませんでした...
プログラムで UIView を作成し、それにボタンを追加します。
UIView *subview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
UIButton *mybutton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[mybutton setTitle:@"Test1" forState:UIControlStateNormal];
mybutton.frame = CGRectMake(0,0,50,50);
[subview mybutton];
レイヤーのプロパティを変更するサブビュー プレゼンテーションで何らかの操作を行うよりも。たとえば、ビューの境界線の半径を変更して影を追加します。
[subview.layer setCornerRadius:10.0f];
[subview.layer setShadowColor:[UIColor blackColor].CGColor];
[subview.layer setShadowOpacity:0.8];
[subview.layer setShadowRadius:3.0];
これらのレイヤーがサブビューだけでなく、mybutton でも変更されるという問題があります。たとえば、ボタンのタイトルにも影があります。私の質問をよりよく説明するために、サンプルのスクリーンショットを作成しました: http://img46.imageshack.us/img46/8923/havq.png
iOSでそれを処理する方法は?ボタンを追加する別のレイヤーのようなものですか?あなたのアドバイスと助けをありがとう!